Skip to content
This repository has been archived by the owner on Sep 10, 2021. It is now read-only.

Commit

Permalink
Update Markdown parser to 1.2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie Snape committed Jun 18, 2014
1 parent 3fcfffa commit ba81d0b
Show file tree
Hide file tree
Showing 3 changed files with 653 additions and 145 deletions.
4 changes: 2 additions & 2 deletions library/Markdown/License.text
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PHP Markdown & Extra
Copyright (c) 2004-2009 Michel Fortin
<http://michelf.com/>
Copyright (c) 2004-2013 Michel Fortin
<http://michelf.ca/>
All rights reserved.

Based on Markdown
Expand Down
185 changes: 139 additions & 46 deletions library/Markdown/PHP Markdown Extra Readme.text
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
PHP Markdown Extra
==================

Version 1.2.5 - Sun 8 Jan 2012
Version 1.2.8 - 29 Nov 2013

by Michel Fortin
<http://michelf.com/>
by Michel Fortin
<http://michelf.ca/>

based on Markdown by John Gruber
<http://daringfireball.net/>
Expand All @@ -25,9 +25,9 @@ tool, written in Perl, that converts the plain text markup to HTML.
PHP Markdown is a port to PHP of the original Markdown program by
John Gruber.

PHP Markdown can work as a plug-in for WordPress and bBlog, as a
modifier for the Smarty templating engine, or as a remplacement for
textile formatting in any software that support textile.
PHP Markdown can work as a plug-in for WordPress, as a modifier for
the Smarty templating engine, or as a replacement for Textile
formatting in any software that supports Textile.

Full documentation of Markdown's syntax is available on John's
Markdown page: <http://daringfireball.net/projects/markdown/>
Expand All @@ -38,14 +38,18 @@ Installation and Requirement

PHP Markdown requires PHP version 4.0.5 or later.

Before PHP 5.3.7, pcre.backtrack_limit defaults to 100 000, which is too small
in many situations. You might need to set it to higher values. Later PHP
releases defaults to 1 000 000, which is usually fine.


### WordPress ###

PHP Markdown works with [WordPress][wp], version 1.2 or later.

[wp]: http://wordpress.org/

1. To use PHP Markdown with WordPress, place the "makrdown.php" file
1. To use PHP Markdown with WordPress, place the "markdown.php" file
in the "plugins" folder. This folder is located inside
"wp-content" at the root of your site:

Expand All @@ -54,56 +58,39 @@ PHP Markdown works with [WordPress][wp], version 1.2 or later.
2. Activate the plugin with the administrative interface of
WordPress. In the "Plugins" section you will now find Markdown.
To activate the plugin, click on the "Activate" button on the
same line than Markdown. Your entries will now be formatted by
same line as Markdown. Your entries will now be formatted by
PHP Markdown.

3. To post Markdown content, you'll first have to disable the
"visual" editor in the User section of WordPress.
"visual" editor in the User section of WordPress.

You can configure PHP Markdown to not apply to the comments on your
WordPress weblog. See the "Configuration" section below.

It is not possible at this time to apply a different set of
filters to different entries. All your entries will be formated by
filters to different entries. All your entries will be formatted by
PHP Markdown. This is a limitation of WordPress. If your old entries
are written in HTML (as opposed to another formatting syntax, like
Textile), they'll probably stay fine after installing Markdown.


### bBlog ###

PHP Markdown also works with [bBlog][bb].

[bb]: http://www.bblog.com/

To use PHP Markdown with bBlog, rename "markdown.php" to
"modifier.markdown.php" and place the file in the "bBlog_plugins"
folder. This folder is located inside the "bblog" directory of
your site, like this:

(site home)/bblog/bBlog_plugins/modifier.markdown.php

Select "Markdown" as the "Entry Modifier" when you post a new
entry. This setting will only apply to the entry you are editing.


### Replacing Textile in TextPattern ###

[TextPattern][tp] use [Textile][tx] to format your text. You can
replace Textile by Markdown in TextPattern without having to change
any code by using the *Texitle Compatibility Mode*. This may work
any code by using the *Textile Compatibility Mode*. This may work
with other software that expect Textile too.

[tx]: http://www.textism.com/tools/textile/
[tp]: http://www.textpattern.com/

1. Rename the "markdown.php" file to "classTextile.php". This will
make PHP Markdown behave as if it was the actual Textile parser.
make PHP Markdown behave as if it was the actual Textile parser.

2. Replace the "classTextile.php" file TextPattern installed in your
web directory. It can be found in the "lib" directory:
web directory. It can be found in the "lib" directory:

(site home)/textpattern/lib/
(site home)/textpattern/lib/

Contrary to Textile, Markdown does not convert quotes to curly ones
and does not convert multiple hyphens (`--` and `---`) into en- and
Expand All @@ -113,7 +100,7 @@ can solve this problem by installing the "smartypants.php" file from
Compatibility Mode function will use SmartyPants automatically without
further modification.

[psp]: http://michelf.com/projects/php-smartypants/
[psp]: http://michelf.ca/projects/php-smartypants/


### In Your Own Programs ###
Expand Down Expand Up @@ -195,15 +182,121 @@ Bugs
----

To file bug reports please send email to:
<michel.fortin@michelf.com>
<michel.fortin@michelf.ca>

Please include with your report: (1) the example input; (2) the output you
expected; (3) the output PHP Markdown actually produced.

If you have a problem where Markdown gives you an empty result, first check
that the backtrack limit is not too low by running `php --info | grep pcre`.
See Installation and Requirement above for details.


Version History
---------------

Extra 1.2.8:

* Added backtick fenced code blocks, originally from Github-flavored Markdown.


1.0.2

* Added support for the `tel:` URL scheme in automatic links.

<tel:+1-111-111-1111>

It gets converted to this (note the `tel:` prefix becomes invisible):

<a href="tel:+1-111-111-1111">+1-111-111-1111</a>


Extra 1.2.7 (11 Apr 2013):

* Added optional class and id attributes to images and links using the same
syntax as for headers:

[link](url){#id .class}
![img](url){#id .class}

It work too for reference-style links and images. In this case you need
to put those attributes at the reference definition:

[link][linkref] or [linkref]
![img][linkref]

[linkref]: url "optional title" {#id .class}

* Fixed a PHP notice message triggered when some table column separator
markers are missing on the separator line below column headers.


1.0.1q (11 Apr 2013):

* Fixed a small mistake that could cause the parser to retain an invalid
state related to parsing links across multiple runs. This was never
observed (that I know of), but it's still worth fixing.


Extra 1.2.6 (13 Jan 2013):

* Headers can now have a class attribute. You can add a class inside the
extra attribute block which can optionally be put after a header:

### Header ### {#id .class1 .class2}

Spaces between components in the brace is optional.

* Fenced code blocks can also have a class and an id attribute. If you only
need to apply a class (typically to indicate the language of a code
snippet), you can write it like this:

~~~ html
<b>bold</b>
~~~

or like this:

~~~ .html
<b>bold</b>
~~~

There is a new configuration option `MARKDOWN_CODE_CLASS_PREFIX` you can
use if you need to append a prefix to the class name.

You might also opt to use an extra attribute block just like for headers:

~~~ {.html #id .codeclass}
<b>bold</b>
~~~

Note that class names added this way are not affected by the
MARKDOWN_CODE_CLASS_PREFIX.

A code block creates a `pre` HTML element containing a `code` element.
The `code` HTML element is the one that receives the attribute. If for
some reason you need attributes to be applied to the enclosing `pre`
element instead, you can set the MARKDOWN_CODE_ATTR_ON_PRE configuration
variable to true.

* Fixed an issue were consecutive fenced code blocks containing HTML-like
code would confuse the parser.

* Multiple references to the same footnote are now allowed.

* Fixed an issue where no_markup mode was ineffective.


1.0.1p (13 Jan 2013):

* Fixed an issue where some XML-style empty tags (such as `<br/>`) were not
recognized correctly as such when inserted into Markdown-formatted text.

* The following HTML 5 elements are treated as block elements when at the
root of an HTML block: `article`, `section`, `nav`, `aside`, `hgroup`,
`header`, `footer`, and `figure`. `svg` too.


1.0.1o (8 Jan 2012):

* Silenced a new warning introduced around PHP 5.3 complaining about
Expand All @@ -224,11 +317,11 @@ Extra 1.2.5 (8 Jan 2012):

* Enabled reference-style shortcut links. Now you can write reference-style
links with less brakets:

This is [my website].

[my website]: http://example.com/

This was added in the 1.0.2 betas, but commented out in the 1.0.1 branch,
waiting for the feature to be officialized. [But half of the other Markdown
implementations are supporting this syntax][half], so it makes sense for
Expand All @@ -238,7 +331,7 @@ Extra 1.2.5 (8 Jan 2012):

* Now accepting many valid email addresses in autolinks that were
previously rejected, such as:

<abc+mailbox/department=shipping@example.com>
<!#$%&'*+-/=?^_`.{|}~@example.com>
<"abc@def"@example.com>
Expand All @@ -247,7 +340,7 @@ Extra 1.2.5 (8 Jan 2012):

* Now accepting spaces in URLs for inline and reference-style links. Such
URLs need to be surrounded by angle brakets. For instance:

[link text](<http://url/with space> "optional title")

[link text][ref]
Expand Down Expand Up @@ -354,27 +447,27 @@ Extra 1.2 (11 May 2008):

* Fix for code blocks as first element of a list item. Previously,
this didn't create any code block for item 2:

* Item 1 (regular paragraph)

* Item 2 (code block)

* A code block starting on the second line of a document wasn't seen
as a code block. This has been fixed.

* Added programatically-settable parser properties `predef_urls` and
`predef_titles` for predefined URLs and titles for reference-style
links. To use this, your PHP code must call the parser this way:

$parser = new Markdwon_Parser;
$parser->predef_urls = array('linkref' => 'http://example.com');
$html = $parser->transform($text);

You can then use the URL as a normal link reference:

[my link][linkref]
[my link][linkRef]

Reference names in the parser properties *must* be lowercase.
Reference names in the Markdown source may have any case.

Expand Down Expand Up @@ -764,8 +857,8 @@ Copyright and License
---------------------

PHP Markdown & Extra
Copyright (c) 2004-2009 Michel Fortin
<http://michelf.com/>
Copyright (c) 2004-2013 Michel Fortin
<http://michelf.ca/>
All rights reserved.

Based on Markdown
Expand Down
Loading

0 comments on commit ba81d0b

Please sign in to comment.