1
1
PHP Markdown Extra
2
2
==================
3
3
4
- Version 1.2.5 - Sun 8 Jan 2012
4
+ Version 1.2.8 - 29 Nov 2013
5
5
6
- by Michel Fortin
7
- <http://michelf.com />
6
+ by Michel Fortin
7
+ <http://michelf.ca />
8
8
9
9
based on Markdown by John Gruber
10
10
<http://daringfireball.net/>
@@ -25,9 +25,9 @@ tool, written in Perl, that converts the plain text markup to HTML.
25
25
PHP Markdown is a port to PHP of the original Markdown program by
26
26
John Gruber.
27
27
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 .
31
31
32
32
Full documentation of Markdown's syntax is available on John's
33
33
Markdown page: <http://daringfireball.net/projects/markdown/>
@@ -38,14 +38,18 @@ Installation and Requirement
38
38
39
39
PHP Markdown requires PHP version 4.0.5 or later.
40
40
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
+
41
45
42
46
### WordPress ###
43
47
44
48
PHP Markdown works with [WordPress][wp], version 1.2 or later.
45
49
46
50
[wp]: http://wordpress.org/
47
51
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
49
53
in the "plugins" folder. This folder is located inside
50
54
"wp-content" at the root of your site:
51
55
@@ -54,56 +58,39 @@ PHP Markdown works with [WordPress][wp], version 1.2 or later.
54
58
2. Activate the plugin with the administrative interface of
55
59
WordPress. In the "Plugins" section you will now find Markdown.
56
60
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
58
62
PHP Markdown.
59
63
60
64
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.
62
66
63
67
You can configure PHP Markdown to not apply to the comments on your
64
68
WordPress weblog. See the "Configuration" section below.
65
69
66
70
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
68
72
PHP Markdown. This is a limitation of WordPress. If your old entries
69
73
are written in HTML (as opposed to another formatting syntax, like
70
74
Textile), they'll probably stay fine after installing Markdown.
71
75
72
76
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
-
90
77
### Replacing Textile in TextPattern ###
91
78
92
79
[TextPattern][tp] use [Textile][tx] to format your text. You can
93
80
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
95
82
with other software that expect Textile too.
96
83
97
84
[tx]: http://www.textism.com/tools/textile/
98
85
[tp]: http://www.textpattern.com/
99
86
100
87
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.
102
89
103
90
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:
105
92
106
- (site home)/textpattern/lib/
93
+ (site home)/textpattern/lib/
107
94
108
95
Contrary to Textile, Markdown does not convert quotes to curly ones
109
96
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
113
100
Compatibility Mode function will use SmartyPants automatically without
114
101
further modification.
115
102
116
- [psp]: http://michelf.com /projects/php-smartypants/
103
+ [psp]: http://michelf.ca /projects/php-smartypants/
117
104
118
105
119
106
### In Your Own Programs ###
@@ -195,15 +182,121 @@ Bugs
195
182
----
196
183
197
184
To file bug reports please send email to:
198
- <michel.fortin@michelf.com >
185
+ <michel.fortin@michelf.ca >
199
186
200
187
Please include with your report: (1) the example input; (2) the output you
201
188
expected; (3) the output PHP Markdown actually produced.
202
189
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
+
203
194
204
195
Version History
205
196
---------------
206
197
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
+ {#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
+
207
300
1.0.1o (8 Jan 2012):
208
301
209
302
* Silenced a new warning introduced around PHP 5.3 complaining about
@@ -224,11 +317,11 @@ Extra 1.2.5 (8 Jan 2012):
224
317
225
318
* Enabled reference-style shortcut links. Now you can write reference-style
226
319
links with less brakets:
227
-
320
+
228
321
This is [my website].
229
-
322
+
230
323
[my website]: http://example.com/
231
-
324
+
232
325
This was added in the 1.0.2 betas, but commented out in the 1.0.1 branch,
233
326
waiting for the feature to be officialized. [But half of the other Markdown
234
327
implementations are supporting this syntax][half], so it makes sense for
@@ -238,7 +331,7 @@ Extra 1.2.5 (8 Jan 2012):
238
331
239
332
* Now accepting many valid email addresses in autolinks that were
240
333
previously rejected, such as:
241
-
334
+
242
335
<abc+mailbox/department=shipping@example.com>
243
336
<!#$%&'*+-/=?^_`.{|}~@example.com>
244
337
<"abc@def"@example.com>
@@ -247,7 +340,7 @@ Extra 1.2.5 (8 Jan 2012):
247
340
248
341
* Now accepting spaces in URLs for inline and reference-style links. Such
249
342
URLs need to be surrounded by angle brakets. For instance:
250
-
343
+
251
344
[link text](<http://url/with space> "optional title")
252
345
253
346
[link text][ref]
@@ -354,27 +447,27 @@ Extra 1.2 (11 May 2008):
354
447
355
448
* Fix for code blocks as first element of a list item. Previously,
356
449
this didn't create any code block for item 2:
357
-
450
+
358
451
* Item 1 (regular paragraph)
359
-
452
+
360
453
* Item 2 (code block)
361
454
362
455
* A code block starting on the second line of a document wasn't seen
363
456
as a code block. This has been fixed.
364
-
457
+
365
458
* Added programatically-settable parser properties `predef_urls` and
366
459
`predef_titles` for predefined URLs and titles for reference-style
367
460
links. To use this, your PHP code must call the parser this way:
368
-
461
+
369
462
$parser = new Markdwon_Parser;
370
463
$parser->predef_urls = array('linkref' => 'http://example.com');
371
464
$html = $parser->transform($text);
372
-
465
+
373
466
You can then use the URL as a normal link reference:
374
467
375
468
[my link][linkref]
376
469
[my link][linkRef]
377
-
470
+
378
471
Reference names in the parser properties *must* be lowercase.
379
472
Reference names in the Markdown source may have any case.
380
473
@@ -764,8 +857,8 @@ Copyright and License
764
857
---------------------
765
858
766
859
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 />
769
862
All rights reserved.
770
863
771
864
Based on Markdown
0 commit comments