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

Commit ba81d0b

Browse files
author
Jamie Snape
committed
Update Markdown parser to 1.2.8
1 parent 3fcfffa commit ba81d0b

File tree

3 files changed

+653
-145
lines changed

3 files changed

+653
-145
lines changed

library/Markdown/License.text

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
PHP Markdown & Extra
2-
Copyright (c) 2004-2009 Michel Fortin
3-
<http://michelf.com/>
2+
Copyright (c) 2004-2013 Michel Fortin
3+
<http://michelf.ca/>
44
All rights reserved.
55

66
Based on Markdown

library/Markdown/PHP Markdown Extra Readme.text

Lines changed: 139 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
PHP Markdown Extra
22
==================
33

4-
Version 1.2.5 - Sun 8 Jan 2012
4+
Version 1.2.8 - 29 Nov 2013
55

6-
by Michel Fortin
7-
<http://michelf.com/>
6+
by Michel Fortin
7+
<http://michelf.ca/>
88

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

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

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

3939
PHP Markdown requires PHP version 4.0.5 or later.
4040

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

4246
### WordPress ###
4347

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

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

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

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

6064
3. To post Markdown content, you'll first have to disable the
61-
"visual" editor in the User section of WordPress.
65+
"visual" editor in the User section of WordPress.
6266

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

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

7276

73-
### bBlog ###
74-
75-
PHP Markdown also works with [bBlog][bb].
76-
77-
[bb]: http://www.bblog.com/
78-
79-
To use PHP Markdown with bBlog, rename "markdown.php" to
80-
"modifier.markdown.php" and place the file in the "bBlog_plugins"
81-
folder. This folder is located inside the "bblog" directory of
82-
your site, like this:
83-
84-
(site home)/bblog/bBlog_plugins/modifier.markdown.php
85-
86-
Select "Markdown" as the "Entry Modifier" when you post a new
87-
entry. This setting will only apply to the entry you are editing.
88-
89-
9077
### Replacing Textile in TextPattern ###
9178

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

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

10087
1. Rename the "markdown.php" file to "classTextile.php". This will
101-
make PHP Markdown behave as if it was the actual Textile parser.
88+
make PHP Markdown behave as if it was the actual Textile parser.
10289

10390
2. Replace the "classTextile.php" file TextPattern installed in your
104-
web directory. It can be found in the "lib" directory:
91+
web directory. It can be found in the "lib" directory:
10592

106-
(site home)/textpattern/lib/
93+
(site home)/textpattern/lib/
10794

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

116-
[psp]: http://michelf.com/projects/php-smartypants/
103+
[psp]: http://michelf.ca/projects/php-smartypants/
117104

118105

119106
### In Your Own Programs ###
@@ -195,15 +182,121 @@ Bugs
195182
----
196183

197184
To file bug reports please send email to:
198-
<michel.fortin@michelf.com>
185+
<michel.fortin@michelf.ca>
199186

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

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

204195
Version History
205196
---------------
206197

198+
Extra 1.2.8:
199+
200+
* Added backtick fenced code blocks, originally from Github-flavored Markdown.
201+
202+
203+
1.0.2
204+
205+
* Added support for the `tel:` URL scheme in automatic links.
206+
207+
<tel:+1-111-111-1111>
208+
209+
It gets converted to this (note the `tel:` prefix becomes invisible):
210+
211+
<a href="tel:+1-111-111-1111">+1-111-111-1111</a>
212+
213+
214+
Extra 1.2.7 (11 Apr 2013):
215+
216+
* Added optional class and id attributes to images and links using the same
217+
syntax as for headers:
218+
219+
[link](url){#id .class}
220+
![img](url){#id .class}
221+
222+
It work too for reference-style links and images. In this case you need
223+
to put those attributes at the reference definition:
224+
225+
[link][linkref] or [linkref]
226+
![img][linkref]
227+
228+
[linkref]: url "optional title" {#id .class}
229+
230+
* Fixed a PHP notice message triggered when some table column separator
231+
markers are missing on the separator line below column headers.
232+
233+
234+
1.0.1q (11 Apr 2013):
235+
236+
* Fixed a small mistake that could cause the parser to retain an invalid
237+
state related to parsing links across multiple runs. This was never
238+
observed (that I know of), but it's still worth fixing.
239+
240+
241+
Extra 1.2.6 (13 Jan 2013):
242+
243+
* Headers can now have a class attribute. You can add a class inside the
244+
extra attribute block which can optionally be put after a header:
245+
246+
### Header ### {#id .class1 .class2}
247+
248+
Spaces between components in the brace is optional.
249+
250+
* Fenced code blocks can also have a class and an id attribute. If you only
251+
need to apply a class (typically to indicate the language of a code
252+
snippet), you can write it like this:
253+
254+
~~~ html
255+
<b>bold</b>
256+
~~~
257+
258+
or like this:
259+
260+
~~~ .html
261+
<b>bold</b>
262+
~~~
263+
264+
There is a new configuration option `MARKDOWN_CODE_CLASS_PREFIX` you can
265+
use if you need to append a prefix to the class name.
266+
267+
You might also opt to use an extra attribute block just like for headers:
268+
269+
~~~ {.html #id .codeclass}
270+
<b>bold</b>
271+
~~~
272+
273+
Note that class names added this way are not affected by the
274+
MARKDOWN_CODE_CLASS_PREFIX.
275+
276+
A code block creates a `pre` HTML element containing a `code` element.
277+
The `code` HTML element is the one that receives the attribute. If for
278+
some reason you need attributes to be applied to the enclosing `pre`
279+
element instead, you can set the MARKDOWN_CODE_ATTR_ON_PRE configuration
280+
variable to true.
281+
282+
* Fixed an issue were consecutive fenced code blocks containing HTML-like
283+
code would confuse the parser.
284+
285+
* Multiple references to the same footnote are now allowed.
286+
287+
* Fixed an issue where no_markup mode was ineffective.
288+
289+
290+
1.0.1p (13 Jan 2013):
291+
292+
* Fixed an issue where some XML-style empty tags (such as `<br/>`) were not
293+
recognized correctly as such when inserted into Markdown-formatted text.
294+
295+
* The following HTML 5 elements are treated as block elements when at the
296+
root of an HTML block: `article`, `section`, `nav`, `aside`, `hgroup`,
297+
`header`, `footer`, and `figure`. `svg` too.
298+
299+
207300
1.0.1o (8 Jan 2012):
208301

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

225318
* Enabled reference-style shortcut links. Now you can write reference-style
226319
links with less brakets:
227-
320+
228321
This is [my website].
229-
322+
230323
[my website]: http://example.com/
231-
324+
232325
This was added in the 1.0.2 betas, but commented out in the 1.0.1 branch,
233326
waiting for the feature to be officialized. [But half of the other Markdown
234327
implementations are supporting this syntax][half], so it makes sense for
@@ -238,7 +331,7 @@ Extra 1.2.5 (8 Jan 2012):
238331

239332
* Now accepting many valid email addresses in autolinks that were
240333
previously rejected, such as:
241-
334+
242335
<abc+mailbox/department=shipping@example.com>
243336
<!#$%&'*+-/=?^_`.{|}~@example.com>
244337
<"abc@def"@example.com>
@@ -247,7 +340,7 @@ Extra 1.2.5 (8 Jan 2012):
247340

248341
* Now accepting spaces in URLs for inline and reference-style links. Such
249342
URLs need to be surrounded by angle brakets. For instance:
250-
343+
251344
[link text](<http://url/with space> "optional title")
252345

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

355448
* Fix for code blocks as first element of a list item. Previously,
356449
this didn't create any code block for item 2:
357-
450+
358451
* Item 1 (regular paragraph)
359-
452+
360453
* Item 2 (code block)
361454

362455
* A code block starting on the second line of a document wasn't seen
363456
as a code block. This has been fixed.
364-
457+
365458
* Added programatically-settable parser properties `predef_urls` and
366459
`predef_titles` for predefined URLs and titles for reference-style
367460
links. To use this, your PHP code must call the parser this way:
368-
461+
369462
$parser = new Markdwon_Parser;
370463
$parser->predef_urls = array('linkref' => 'http://example.com');
371464
$html = $parser->transform($text);
372-
465+
373466
You can then use the URL as a normal link reference:
374467

375468
[my link][linkref]
376469
[my link][linkRef]
377-
470+
378471
Reference names in the parser properties *must* be lowercase.
379472
Reference names in the Markdown source may have any case.
380473

@@ -764,8 +857,8 @@ Copyright and License
764857
---------------------
765858

766859
PHP Markdown & Extra
767-
Copyright (c) 2004-2009 Michel Fortin
768-
<http://michelf.com/>
860+
Copyright (c) 2004-2013 Michel Fortin
861+
<http://michelf.ca/>
769862
All rights reserved.
770863

771864
Based on Markdown

0 commit comments

Comments
 (0)