Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 797 lines (521 sloc) 27.252 kb
bdcd08b Michel Fortin Base for Object-Oriented PHP Markdown
authored
1 PHP Markdown
2 ============
3
fa3c7ad Michel Fortin Bumped version to 1.0.2 and updated readme file.
authored
4 Version 1.0.2 - 29 Nov 2013
bdcd08b Michel Fortin Base for Object-Oriented PHP Markdown
authored
5
14f771a Michel Fortin Bumped version to 1.0.1p.
authored
6 by Michel Fortin
c634db3 Michel Fortin Changted michelf.com to michelf.ca, as mty website has changed domain.
authored
7 <http://michelf.ca/>
bdcd08b Michel Fortin Base for Object-Oriented PHP Markdown
authored
8
9 based on work by John Gruber
10 <http://daringfireball.net/>
11
12
13 Introduction
14 ------------
15
16 Markdown is a text-to-HTML conversion tool for web writers. Markdown
17 allows you to write using an easy-to-read, easy-to-write plain text
18 format, then convert it to structurally valid XHTML (or HTML).
19
20 "Markdown" is two things: a plain text markup syntax, and a software
21 tool, written in Perl, that converts the plain text markup to HTML.
22 PHP Markdown is a port to PHP of the original Markdown program by
23 John Gruber.
24
14f771a Michel Fortin Bumped version to 1.0.1p.
authored
25 PHP Markdown can work as a plug-in for WordPress, as a modifier for
26 the Smarty templating engine, or as a replacement for Textile
27 formatting in any software that supports Textile.
bdcd08b Michel Fortin Base for Object-Oriented PHP Markdown
authored
28
29 Full documentation of Markdown's syntax is available on John's
30 Markdown page: <http://daringfireball.net/projects/markdown/>
31
32
33 Installation and Requirement
34 ----------------------------
35
36 PHP Markdown requires PHP version 4.0.5 or later.
a74017d Michel Fortin Clarified issues around backtrack limits.
authored
37
38 Before PHP 5.3.7, pcre.backtrack_limit defaults to 100 000, which is too small
39 in many situations. You might need to set it to higher values. Later PHP
40 releases defaults to 1 000 000, which is usually fine.
bdcd08b Michel Fortin Base for Object-Oriented PHP Markdown
authored
41
42
43 ### WordPress ###
44
5e35391 Michel Fortin Removed outdated remark in readme about being bundled with WordPress def...
authored
45 PHP Markdown works with [WordPress][wp], version 1.2 or later.
bdcd08b Michel Fortin Base for Object-Oriented PHP Markdown
authored
46
47 [wp]: http://wordpress.org/
48
c89732d Fixed: Typo errors in readme file.
Jo Michael authored
49 1. To use PHP Markdown with WordPress, place the "markdown.php" file
bdcd08b Michel Fortin Base for Object-Oriented PHP Markdown
authored
50 in the "plugins" folder. This folder is located inside
51 "wp-content" at the root of your site:
52
53 (site home)/wp-content/plugins/
54
55 2. Activate the plugin with the administrative interface of
56 WordPress. In the "Plugins" section you will now find Markdown.
57 To activate the plugin, click on the "Activate" button on the
c89732d Fixed: Typo errors in readme file.
Jo Michael authored
58 same line as Markdown. Your entries will now be formatted by
bdcd08b Michel Fortin Base for Object-Oriented PHP Markdown
authored
59 PHP Markdown.
60
8699f81 Michel Fortin PHP Markdown 1.0.1d
authored
61 3. To post Markdown content, you'll first have to disable the
c89732d Fixed: Typo errors in readme file.
Jo Michael authored
62 "visual" editor in the User section of WordPress.
8699f81 Michel Fortin PHP Markdown 1.0.1d
authored
63
bdcd08b Michel Fortin Base for Object-Oriented PHP Markdown
authored
64 You can configure PHP Markdown to not apply to the comments on your
65 WordPress weblog. See the "Configuration" section below.
66
8699f81 Michel Fortin PHP Markdown 1.0.1d
authored
67 It is not possible at this time to apply a different set of
c89732d Fixed: Typo errors in readme file.
Jo Michael authored
68 filters to different entries. All your entries will be formatted by
8699f81 Michel Fortin PHP Markdown 1.0.1d
authored
69 PHP Markdown. This is a limitation of WordPress. If your old entries
70 are written in HTML (as opposed to another formatting syntax, like
71 Textile), they'll probably stay fine after installing Markdown.
bdcd08b Michel Fortin Base for Object-Oriented PHP Markdown
authored
72
73
8699f81 Michel Fortin PHP Markdown 1.0.1d
authored
74 ### Replacing Textile in TextPattern ###
bdcd08b Michel Fortin Base for Object-Oriented PHP Markdown
authored
75
8699f81 Michel Fortin PHP Markdown 1.0.1d
authored
76 [TextPattern][tp] use [Textile][tx] to format your text. You can
77 replace Textile by Markdown in TextPattern without having to change
c89732d Fixed: Typo errors in readme file.
Jo Michael authored
78 any code by using the *Textile Compatibility Mode*. This may work
8699f81 Michel Fortin PHP Markdown 1.0.1d
authored
79 with other software that expect Textile too.
bdcd08b Michel Fortin Base for Object-Oriented PHP Markdown
authored
80
81 [tx]: http://www.textism.com/tools/textile/
8699f81 Michel Fortin PHP Markdown 1.0.1d
authored
82 [tp]: http://www.textpattern.com/
bdcd08b Michel Fortin Base for Object-Oriented PHP Markdown
authored
83
8699f81 Michel Fortin PHP Markdown 1.0.1d
authored
84 1. Rename the "markdown.php" file to "classTextile.php". This will
c89732d Fixed: Typo errors in readme file.
Jo Michael authored
85 make PHP Markdown behave as if it was the actual Textile parser.
bdcd08b Michel Fortin Base for Object-Oriented PHP Markdown
authored
86
8699f81 Michel Fortin PHP Markdown 1.0.1d
authored
87 2. Replace the "classTextile.php" file TextPattern installed in your
c89732d Fixed: Typo errors in readme file.
Jo Michael authored
88 web directory. It can be found in the "lib" directory:
bdcd08b Michel Fortin Base for Object-Oriented PHP Markdown
authored
89
c89732d Fixed: Typo errors in readme file.
Jo Michael authored
90 (site home)/textpattern/lib/
bdcd08b Michel Fortin Base for Object-Oriented PHP Markdown
authored
91
92 Contrary to Textile, Markdown does not convert quotes to curly ones
93 and does not convert multiple hyphens (`--` and `---`) into en- and
94 em-dashes. If you use PHP Markdown in Textile Compatibility Mode, you
95 can solve this problem by installing the "smartypants.php" file from
96 [PHP SmartyPants][psp] beside the "classTextile.php" file. The Textile
97 Compatibility Mode function will use SmartyPants automatically without
98 further modification.
99
c634db3 Michel Fortin Changted michelf.com to michelf.ca, as mty website has changed domain.
authored
100 [psp]: http://michelf.ca/projects/php-smartypants/
bdcd08b Michel Fortin Base for Object-Oriented PHP Markdown
authored
101
102
d3693aa Michel Fortin PHP Markdown 1.0.1e
authored
103 ### Updating Markdown in Other Programs ###
104
105 Many web applications now ship with PHP Markdown, or have plugins to
106 perform the conversion to HTML. You can update PHP Markdown in many of
107 these programs by swapping the old "markdown.php" file for the new one.
108
f04d6c1 Michel Fortin PHP Markdown 1.0.1f
authored
109 Here is a short non-exhaustive list of some programs and where they
d3693aa Michel Fortin PHP Markdown 1.0.1e
authored
110 hide the "markdown.php" file.
111
112 | Program | Path to Markdown
113 | ------- | ----------------
114 | [Pivot][] | `(site home)/pivot/includes/markdown/markdown.php`
115
116 If you're unsure if you can do this with your application, ask the
117 developer, or wait for the developer to update his application or
118 plugin with the new version of PHP Markdown.
119
120 [Pivot]: http://pivotlog.net/
121
122
bdcd08b Michel Fortin Base for Object-Oriented PHP Markdown
authored
123 ### In Your Own Programs ###
124
125 You can use PHP Markdown easily in your current PHP program. Simply
126 include the file and then call the Markdown function on the text you
127 want to convert:
128
129 include_once "markdown.php";
130 $my_html = Markdown($my_text);
131
132 If you wish to use PHP Markdown with another text filter function
133 built to parse HTML, you should filter the text *after* the Markdown
134 function call. This is an example with [PHP SmartyPants][psp]:
135
136 $my_html = SmartyPants(Markdown($my_text));
137
138
139 ### With Smarty ###
140
141 If your program use the [Smarty][sm] template engine, PHP Markdown
142 can now be used as a modifier for your templates. Rename "markdown.php"
143 to "modifier.markdown.php" and put it in your smarty plugins folder.
144
145 [sm]: http://smarty.php.net/
146
147 If you are using MovableType 3.1 or later, the Smarty plugin folder is
148 located at `(MT CGI root)/php/extlib/smarty/plugins`. This will allow
149 Markdown to work on dynamic pages.
150
151
152 Configuration
153 -------------
154
155 By default, PHP Markdown produces XHTML output for tags with empty
156 elements. E.g.:
157
158 <br />
159
160 Markdown can be configured to produce HTML-style tags; e.g.:
161
162 <br>
163
8699f81 Michel Fortin PHP Markdown 1.0.1d
authored
164 To do this, you must edit the "MARKDOWN_EMPTY_ELEMENT_SUFFIX"
165 definition below the "Global default settings" header at the start of
166 the "markdown.php" file.
bdcd08b Michel Fortin Base for Object-Oriented PHP Markdown
authored
167
168
169 ### WordPress-Specific Settings ###
170
171 By default, the Markdown plugin applies to both posts and comments on
172 your WordPress weblog. To deactivate one or the other, edit the
8699f81 Michel Fortin PHP Markdown 1.0.1d
authored
173 `MARKDOWN_WP_POSTS` or `MARKDOWN_WP_COMMENTS` definitions under the
174 "WordPress settings" header at the start of the "markdown.php" file.
bdcd08b Michel Fortin Base for Object-Oriented PHP Markdown
authored
175
176
177 Bugs
178 ----
179
180 To file bug reports please send email to:
c634db3 Michel Fortin Changted michelf.com to michelf.ca, as mty website has changed domain.
authored
181 <michel.fortin@michelf.ca>
bdcd08b Michel Fortin Base for Object-Oriented PHP Markdown
authored
182
183 Please include with your report: (1) the example input; (2) the output you
a74017d Michel Fortin Clarified issues around backtrack limits.
authored
184 expected; (3) the output PHP Markdown actually produced.
185
186 If you have a problem where Markdown gives you an empty result, first check
187 that the backtrack limit is not too low by running `php --info | grep pcre`.
188 See Installation and Requirement above for details.
bdcd08b Michel Fortin Base for Object-Oriented PHP Markdown
authored
189
190
191 Version History
192 ---------------
193
fa3c7ad Michel Fortin Bumped version to 1.0.2 and updated readme file.
authored
194 1.0.2 (29 Nov 2013)
195
196 * Added support for the `tel:` URL scheme in automatic links.
197
198 <tel:+1-111-111-1111>
199
200 It gets converted to this (note the `tel:` prefix becomes invisible):
201
202 <a href="tel:+1-111-111-1111">+1-111-111-1111</a>
203
204
91e8734 Michel Fortin Bumped version number to 1.0.1q and added some version history.
authored
205 1.0.1q (11 Apr 2013):
206
207 * Fixed a small mistake that could cause the parser to retain an invalid
208 state related to parsing links across multiple runs. This was never
209 observed (that I know of), but it's still worth fixing.
210
211
14f771a Michel Fortin Bumped version to 1.0.1p.
authored
212 1.0.1p (13 Jan 2013):
a09e65c Michel Fortin Added HTML 5 elements to the block parser.
authored
213
fdd003e Michel Fortin XML-style empty tags were not recognized correctly when the / was not pr...
authored
214 * Fixed an issue where some XML-style empty tags (such as `<br/>`) were not
215 recognized correctly as such when inserted into Markdown-formatted text.
216
a09e65c Michel Fortin Added HTML 5 elements to the block parser.
authored
217 * The following HTML 5 elements are treated as block elements when at the
218 root of an HTML block: `article`, `section`, `nav`, `aside`, `hgroup`,
219 `header`, `footer`, and `figure`. `svg` too.
220
221
b1bc42e Michel Fortin Updated to version number 1.0.1o.
authored
222 1.0.1o (8 Jan 2012):
94328b4 Michel Fortin Updated readme.
authored
223
224 * Silenced a new warning introduced around PHP 5.3 complaining about
225 POSIX characters classes not being implemented. PHP Markdown does not
226 use POSIX character classes, but it nevertheless trigged that warning.
227
228
cedf65f Michel Fortin Updated version number to 1.0.1m.
authored
229 1.0.1n (10 Oct 2009):
4bd7fac Michel Fortin Fix for adjacent list of different kind.
authored
230
7123d05 Michel Fortin Enabled reference-style shortcuts.
authored
231 * Enabled reference-style shortcut links. Now you can write reference-style
232 links with less brakets:
c89732d Fixed: Typo errors in readme file.
Jo Michael authored
233
7123d05 Michel Fortin Enabled reference-style shortcuts.
authored
234 This is [my website].
c89732d Fixed: Typo errors in readme file.
Jo Michael authored
235
7123d05 Michel Fortin Enabled reference-style shortcuts.
authored
236 [my website]: http://example.com/
c89732d Fixed: Typo errors in readme file.
Jo Michael authored
237
7123d05 Michel Fortin Enabled reference-style shortcuts.
authored
238 This was added in the 1.0.2 betas, but commented out in the 1.0.1 branch,
239 waiting for the feature to be officialized. [But half of the other Markdown
240 implementations are supporting this syntax][half], so it makes sense for
241 compatibility's sake to allow it in PHP Markdown too.
242
243 [half]: http://babelmark.bobtfish.net/?markdown=This+is+%5Bmy+website%5D.%0D%0A%09%09%0D%0A%5Bmy+website%5D%3A+http%3A%2F%2Fexample.com%2F%0D%0A&src=1&dest=2
244
76d4ba8 Michel Fortin Added missing changelog entry.
authored
245 * Now accepting many valid email addresses in autolinks that were
246 previously rejected, such as:
c89732d Fixed: Typo errors in readme file.
Jo Michael authored
247
76d4ba8 Michel Fortin Added missing changelog entry.
authored
248 <abc+mailbox/department=shipping@example.com>
249 <!#$%&'*+-/=?^_`.{|}~@example.com>
250 <"abc@def"@example.com>
251 <"Fred Bloggs"@example.com>
252 <jsmith@[192.0.2.1]>
253
cffcfe4 Michel Fortin Added another missing changelog entry for URLs containing spaces.
authored
254 * Now accepting spaces in URLs for inline and reference-style links. Such
255 URLs need to be surrounded by angle brakets. For instance:
c89732d Fixed: Typo errors in readme file.
Jo Michael authored
256
cffcfe4 Michel Fortin Added another missing changelog entry for URLs containing spaces.
authored
257 [link text](<http://url/with space> "optional title")
258
259 [link text][ref]
260 [ref]: <http://url/with space> "optional title"
261
262 There is still a quirk which may prevent this from working correctly with
263 relative URLs in inline-style links however.
264
cedf65f Michel Fortin Updated version number to 1.0.1m.
authored
265 * Fix for adjacent list of different kind where the second list could
266 end as a sublist of the first when not separated by an empty line.
267
b820a9a Michel Fortin Now allowing newlines inside inline-style link definitions.
authored
268 * Fixed a bug where inline-style links wouldn't be recognized when the link
269 definition contains a line break between the url and the title.
270
d64613d Michel Fortin Fix for tags with underscore.
authored
271 * Fixed a bug where tags where the name contains an underscore aren't parsed
272 correctly.
273
8dcbb99 Michel Fortin Fixed some emphasis corner-cases.
authored
274 * Fixed some corner-cases mixing underscore-ephasis and asterisk-emphasis.
275
4bd7fac Michel Fortin Fix for adjacent list of different kind.
authored
276
9c0365f Michel Fortin Updated version number to 1.0.1m.
authored
277 1.0.1m (21 Jun 2008):
4ba5b32 Michel Fortin Lists can now have empty items.
authored
278
279 * Lists can now have empty items.
280
f6a8c76 Michel Fortin Rewrote the emphasis and strong emphasis parser.
authored
281 * Rewrote the emphasis and strong emphasis parser to fix some issues
282 with odly placed and overlong markers.
283
4ba5b32 Michel Fortin Lists can now have empty items.
authored
284
9c0365f Michel Fortin Updated version number to 1.0.1m.
authored
285 1.0.1l (11 May 2008):
83c4ffe Michel Fortin Added version history for changes since 1.0.1k.
authored
286
287 * Now removing the UTF-8 BOM at the start of a document, if present.
288
289 * Now accepting capitalized URI schemes (such as HTTP:) in automatic
290 links, such as `<HTTP://EXAMPLE.COM/>`.
291
292 * Fixed a problem where `<hr@example.com>` was seen as a horizontal
293 rule instead of an automatic link.
294
295 * Fixed an issue where some characters in Markdown-generated HTML
296 attributes weren't properly escaped with entities.
297
298 * Fix for code blocks as first element of a list item. Previously,
299 this didn't create any code block for item 2:
c89732d Fixed: Typo errors in readme file.
Jo Michael authored
300
83c4ffe Michel Fortin Added version history for changes since 1.0.1k.
authored
301 * Item 1 (regular paragraph)
c89732d Fixed: Typo errors in readme file.
Jo Michael authored
302
83c4ffe Michel Fortin Added version history for changes since 1.0.1k.
authored
303 * Item 2 (code block)
304
65737a4 Michel Fortin Fixed a typo.
authored
305 * A code block starting on the second line of a document wasn't seen
83c4ffe Michel Fortin Added version history for changes since 1.0.1k.
authored
306 as a code block. This has been fixed.
c89732d Fixed: Typo errors in readme file.
Jo Michael authored
307
452117f Michel Fortin Updated version history.
authored
308 * Added programatically-settable parser properties `predef_urls` and
315d1f9 Michel Fortin Added more precision to the predefined URLs and titles feature.
authored
309 `predef_titles` for predefined URLs and titles for reference-style
310 links. To use this, your PHP code must call the parser this way:
c89732d Fixed: Typo errors in readme file.
Jo Michael authored
311
452117f Michel Fortin Updated version history.
authored
312 $parser = new Markdwon_Parser;
315d1f9 Michel Fortin Added more precision to the predefined URLs and titles feature.
authored
313 $parser->predef_urls = array('linkref' => 'http://example.com');
452117f Michel Fortin Updated version history.
authored
314 $html = $parser->transform($text);
c89732d Fixed: Typo errors in readme file.
Jo Michael authored
315
315d1f9 Michel Fortin Added more precision to the predefined URLs and titles feature.
authored
316 You can then use the URL as a normal link reference:
317
318 [my link][linkref]
319 [my link][linkRef]
c89732d Fixed: Typo errors in readme file.
Jo Michael authored
320
315d1f9 Michel Fortin Added more precision to the predefined URLs and titles feature.
authored
321 Reference names in the parser properties *must* be lowercase.
322 Reference names in the Markdown source may have any case.
452117f Michel Fortin Updated version history.
authored
323
324 * Added `setup` and `teardown` methods which can be used by subclassers
325 as hook points to arrange the state of some parser variables before and
326 after parsing.
83c4ffe Michel Fortin Added version history for changes since 1.0.1k.
authored
327
328
4f0e737 Michel Fortin Added release date and notes for 1.0.1k.
authored
329 1.0.1k (26 Sep 2007):
330
331 * Fixed a problem introduced in 1.0.1i where three or more identical
332 uppercase letters, as well as a few other symbols, would trigger
333 a horizontal line.
334
335
152860c Michel Fortin Prepared version 1.0.1j
authored
336 1.0.1j (4 Sep 2007):
337
338 * Fixed a problem introduced in 1.0.1i where the closing `code` and
339 `pre` tags at the end of a code block were appearing in the wrong
340 order.
341
a26e466 Michel Fortin Made settings overridable.
authored
342 * Overriding configuration settings by defining constants from an
343 external before markdown.php is included is now possible without
344 producing a PHP warning.
345
152860c Michel Fortin Prepared version 1.0.1j
authored
346
f9f857b Michel Fortin Fixed release date.
authored
347 1.0.1i (31 Aug 2007):
e2b2ddc Michel Fortin Fixed bug with backslash before code span, fixed a speed issue with "unh...
authored
348
349 * Fixed a problem where an escaped backslash before a code span
350 would prevent the code span from being created. This should now
351 work as expected:
352
353 Litteral backslash: \\`code span`
354
355 * Overall speed improvements, especially with long documents.
356
357
df63987 Michel Fortin PHP Markdown 1.0.1h
authored
358 1.0.1h (3 Aug 2007):
359
360 * Added two properties (`no_markup` and `no_entities`) to the parser
361 allowing HTML tags and entities to be disabled.
362
363 * Fix for a problem introduced in 1.0.1g where posting comments in
364 WordPress would trigger PHP warnings and cause some markup to be
365 incorrectly filtered by the kses filter in WordPress.
366
367
89dafd4 Michel Fortin PHP Markdown 1.0.1g
authored
368 1.0.1g (3 Jul 2007):
369
370 * Fix for PHP 5 compiled without the mbstring module. Previous fix to
371 calculate the length of UTF-8 strings in `detab` when `mb_strlen` is
372 not available was only working with PHP 4.
373
374 * Fixed a problem with WordPress 2.x where full-content posts in RSS feeds
375 were not processed correctly by Markdown.
376
377 * Now supports URLs containing literal parentheses for inline links
378 and images, such as:
379
380 [WIMP](http://en.wikipedia.org/wiki/WIMP_(computing))
381
382 Such parentheses may be arbitrarily nested, but must be
383 balanced. Unbalenced parentheses are allowed however when the URL
384 when escaped or when the URL is enclosed in angle brakets `<>`.
385
386 * Fixed a performance problem where the regular expression for strong
387 emphasis introduced in version 1.0.1d could sometime be long to process,
388 give slightly wrong results, and in some circumstances could remove
389 entirely the content for a whole paragraph.
390
391 * Some change in version 1.0.1d made possible the incorrect nesting of
392 anchors within each other. This is now fixed.
393
394 * Fixed a rare issue where certain MD5 hashes in the content could
395 be changed to their corresponding text. For instance, this:
396
397 The MD5 value for "+" is "26b17225b626fb9238849fd60eabdf60".
398
399 was incorrectly changed to this in previous versions of PHP Markdown:
400
401 <p>The MD5 value for "+" is "+".</p>
402
403 * Now convert escaped characters to their numeric character
404 references equivalent.
405
406 This fix an integration issue with SmartyPants and backslash escapes.
407 Since Markdown and SmartyPants have some escapable characters in common,
408 it was sometime necessary to escape them twice. Previously, two
409 backslashes were sometime required to prevent Markdown from "eating" the
410 backslash before SmartyPants sees it:
411
412 Here are two hyphens: \\--
413
414 Now, only one backslash will do:
415
416 Here are two hyphens: \--
417
418
f04d6c1 Michel Fortin PHP Markdown 1.0.1f
authored
419 1.0.1f (7 Feb 2007):
420
421 * Fixed an issue with WordPress where manually-entered excerpts, but
422 not the auto-generated ones, would contain nested paragraphs.
423
424 * Fixed an issue introduced in 1.0.1d where headers and blockquotes
425 preceded too closely by a paragraph (not separated by a blank line)
426 where incorrectly put inside the paragraph.
427
428 * Fixed an issue introduced in 1.0.1d in the tokenizeHTML method where
429 two consecutive code spans would be merged into one when together they
430 form a valid tag in a multiline paragraph.
431
432 * Fixed an long-prevailing issue where blank lines in code blocks would
433 be doubled when the code block is in a list item.
434
435 This was due to the list processing functions relying on artificially
436 doubled blank lines to correctly determine when list items should
437 contain block-level content. The list item processing model was thus
438 changed to avoid the need for double blank lines.
439
440 * Fixed an issue with `<% asp-style %>` instructions used as inline
441 content where the opening `<` was encoded as `&lt;`.
442
443 * Fixed a parse error occuring when PHP is configured to accept
444 ASP-style delimiters as boundaries for PHP scripts.
445
446 * Fixed a bug introduced in 1.0.1d where underscores in automatic links
447 got swapped with emphasis tags.
448
449
d3693aa Michel Fortin PHP Markdown 1.0.1e
authored
450 1.0.1e (28 Dec 2006)
451
452 * Added support for internationalized domain names for email addresses in
453 automatic link. Improved the speed at which email addresses are converted
454 to entities. Thanks to Milian Wolff for his optimisations.
455
456 * Made deterministic the conversion to entities of email addresses in
457 automatic links. This means that a given email address will always be
458 encoded the same way.
459
460 * PHP Markdown will now use its own function to calculate the length of an
461 UTF-8 string in `detab` when `mb_strlen` is not available instead of
462 giving a fatal error.
463
464
8699f81 Michel Fortin PHP Markdown 1.0.1d
authored
465 1.0.1d (1 Dec 2006)
466
467 * Fixed a bug where inline images always had an empty title attribute. The
468 title attribute is now present only when explicitly defined.
469
470 * Link references definitions can now have an empty title, previously if the
471 title was defined but left empty the link definition was ignored. This can
472 be useful if you want an empty title attribute in images to hide the
473 tooltip in Internet Explorer.
474
475 * Made `detab` aware of UTF-8 characters. UTF-8 multi-byte sequences are now
476 correctly mapped to one character instead of the number of bytes.
477
478 * Fixed a small bug with WordPress where WordPress' default filter `wpautop`
479 was not properly deactivated on comment text, resulting in hard line breaks
480 where Markdown do not prescribes them.
481
482 * Added a `TextileRestrited` method to the textile compatibility mode. There
483 is no restriction however, as Markdown does not have a restricted mode at
484 this point. This should make PHP Markdown work again in the latest
485 versions of TextPattern.
486
487 * Converted PHP Markdown to a object-oriented design.
488
489 * Changed span and block gamut methods so that they loop over a
490 customizable list of methods. This makes subclassing the parser a more
491 interesting option for creating syntax extensions.
492
493 * Also added a "document" gamut loop which can be used to hook document-level
494 methods (like for striping link definitions).
495
496 * Changed all methods which were inserting HTML code so that they now return
497 a hashed representation of the code. New methods `hashSpan` and `hashBlock`
498 are used to hash respectivly span- and block-level generated content. This
499 has a couple of significant effects:
500
501 1. It prevents invalid nesting of Markdown-generated elements which
502 could occur occuring with constructs like `*something [link*][1]`.
503 2. It prevents problems occuring with deeply nested lists on which
504 paragraphs were ill-formed.
505 3. It removes the need to call `hashHTMLBlocks` twice during the the
506 block gamut.
507
508 Hashes are turned back to HTML prior output.
509
510 * Made the block-level HTML parser smarter using a specially-crafted regular
511 expression capable of handling nested tags.
512
513 * Solved backtick issues in tag attributes by rewriting the HTML tokenizer to
514 be aware of code spans. All these lines should work correctly now:
515
516 <span attr='`ticks`'>bar</span>
517 <span attr='``double ticks``'>bar</span>
518 `<test a="` content of attribute `">`
519
520 * Changed the parsing of HTML comments to match simply from `<!--` to `-->`
521 instead using of the more complicated SGML-style rule with paired `--`.
522 This is how most browsers parse comments and how XML defines them too.
523
524 * `<address>` has been added to the list of block-level elements and is now
525 treated as an HTML block instead of being wrapped within paragraph tags.
526
527 * Now only trim trailing newlines from code blocks, instead of trimming
528 all trailing whitespace characters.
529
530 * Fixed bug where this:
531
532 [text](http://m.com "title" )
533
534 wasn't working as expected, because the parser wasn't allowing for spaces
535 before the closing paren.
536
537 * Filthy hack to support markdown='1' in div tags.
538
539 * _DoAutoLinks() now supports the 'dict://' URL scheme.
540
541 * PHP- and ASP-style processor instructions are now protected as
542 raw HTML blocks.
543
544 <? ... ?>
545 <% ... %>
546
547 * Fix for escaped backticks still triggering code spans:
548
549 There are two raw backticks here: \` and here: \`, not a code span
550
551
552 1.0.1c (9 Dec 2005)
553
554 * Fixed a problem occurring with PHP 5.1.1 due to a small
555 change to strings variable replacement behaviour in
556 this version.
557
bdcd08b Michel Fortin Base for Object-Oriented PHP Markdown
authored
558
559 1.0.1b (6 Jun 2005)
560
561 * Fixed a bug where an inline image followed by a reference link would
562 give a completely wrong result.
563
564 * Fix for escaped backticks still triggering code spans:
565
566 There are two raw backticks here: \` and here: \`, not a code span
567
568 * Fix for an ordered list following an unordered list, and the
569 reverse. There is now a loop in _DoList that does the two
570 separately.
571
572 * Fix for nested sub-lists in list-paragraph mode. Previously we got
573 a spurious extra level of `<p>` tags for something like this:
574
575 * this
576
577 * sub
578
579 that
580
581 * Fixed some incorrect behaviour with emphasis. This will now work
582 as it should:
583
584 *test **thing***
585 **test *thing***
586 ***thing* test**
587 ***thing** test*
588
589 Name: __________
590 Address: _______
591
592 * Correct a small bug in `_TokenizeHTML` where a Doctype declaration
593 was not seen as HTML.
594
595 * Major rewrite of the WordPress integration code that should
596 correct many problems by preventing default WordPress filters from
597 tampering with Markdown-formatted text. More details here:
c634db3 Michel Fortin Changted michelf.com to michelf.ca, as mty website has changed domain.
authored
598 <http://michelf.ca/weblog/2005/wordpress-text-flow-vs-markdown/>
bdcd08b Michel Fortin Base for Object-Oriented PHP Markdown
authored
599
600
601 1.0.1a (15 Apr 2005)
602
603 * Fixed an issue where PHP warnings were trigged when converting
604 text with list items running on PHP 4.0.6. This was comming from
605 the `rtrim` function which did not support the second argument
606 prior version 4.1. Replaced by a regular expression.
607
608 * Markdown now filter correctly post excerpts and comment
609 excerpts in WordPress.
610
611 * Automatic links and some code sample were "corrected" by
612 the balenceTag filter in WordPress meant to ensure HTML
613 is well formed. This new version of PHP Markdown postpone this
614 filter so that it runs after Markdown.
615
616 * Blockquote syntax and some code sample were stripped by
617 a new WordPress 1.5 filter meant to remove unwanted HTML
618 in comments. This new version of PHP Markdown postpone this
619 filter so that it runs after Markdown.
620
621
622 1.0.1 (16 Dec 2004):
623
624 * Changed the syntax rules for code blocks and spans. Previously,
625 backslash escapes for special Markdown characters were processed
626 everywhere other than within inline HTML tags. Now, the contents of
627 code blocks and spans are no longer processed for backslash escapes.
628 This means that code blocks and spans are now treated literally,
629 with no special rules to worry about regarding backslashes.
630
631 **IMPORTANT**: This breaks the syntax from all previous versions of
632 Markdown. Code blocks and spans involving backslash characters will
633 now generate different output than before.
634
635 Implementation-wise, this change was made by moving the call to
636 `_EscapeSpecialChars()` from the top-level `Markdown()` function to
637 within `_RunSpanGamut()`.
638
639 * Significants performance improvement in `_DoHeader`, `_Detab`
640 and `_TokenizeHTML`.
641
642 * Added `>`, `+`, and `-` to the list of backslash-escapable
643 characters. These should have been done when these characters
644 were added as unordered list item markers.
645
646 * Inline links using `<` and `>` URL delimiters weren't working:
647
648 like [this](<http://example.com/>)
649
650 Fixed by moving `_DoAutoLinks()` after `_DoAnchors()` in
651 `_RunSpanGamut()`.
652
653 * Fixed bug where auto-links were being processed within code spans:
654
655 like this: `<http://example.com/>`
656
657 Fixed by moving `_DoAutoLinks()` from `_RunBlockGamut()` to
658 `_RunSpanGamut()`.
659
660 * Sort-of fixed a bug where lines in the middle of hard-wrapped
661 paragraphs, which lines look like the start of a list item,
662 would accidentally trigger the creation of a list. E.g. a
663 paragraph that looked like this:
664
665 I recommend upgrading to version
666 8. Oops, now this line is treated
667 as a sub-list.
668
669 This is fixed for top-level lists, but it can still happen for
670 sub-lists. E.g., the following list item will not be parsed
671 properly:
672
673 * I recommend upgrading to version
674 8. Oops, now this line is treated
675 as a sub-list.
676
677 Given Markdown's list-creation rules, I'm not sure this can
678 be fixed.
679
680 * Fix for horizontal rules preceded by 2 or 3 spaces or followed by
681 trailing spaces and tabs.
682
683 * Standalone HTML comments are now handled; previously, they'd get
684 wrapped in a spurious `<p>` tag.
685
686 * `_HashHTMLBlocks()` now tolerates trailing spaces and tabs following
687 HTML comments and `<hr/>` tags.
688
689 * Changed special case pattern for hashing `<hr>` tags in
690 `_HashHTMLBlocks()` so that they must occur within three spaces
691 of left margin. (With 4 spaces or a tab, they should be
692 code blocks, but weren't before this fix.)
693
694 * Auto-linked email address can now optionally contain
695 a 'mailto:' protocol. I.e. these are equivalent:
696
697 <mailto:user@example.com>
698 <user@example.com>
699
700 * Fixed annoying bug where nested lists would wind up with
701 spurious (and invalid) `<p>` tags.
702
703 * Changed `_StripLinkDefinitions()` so that link definitions must
704 occur within three spaces of the left margin. Thus if you indent
705 a link definition by four spaces or a tab, it will now be a code
706 block.
707
708 * You can now write empty links:
709
710 [like this]()
711
712 and they'll be turned into anchor tags with empty href attributes.
713 This should have worked before, but didn't.
714
715 * `***this***` and `___this___` are now turned into
716
717 <strong><em>this</em></strong>
718
719 Instead of
720
721 <strong><em>this</strong></em>
722
723 which isn't valid.
724
725 * Fixed problem for links defined with urls that include parens, e.g.:
726
727 [1]: http://sources.wikipedia.org/wiki/Middle_East_Policy_(Chomsky)
728
729 "Chomsky" was being erroneously treated as the URL's title.
730
731 * Double quotes in the title of an inline link used to give strange
732 results (incorrectly made entities). Fixed.
733
734 * Tabs are now correctly changed into spaces. Previously, only
735 the first tab was converted. In code blocks, the second one was too,
736 but was not always correctly aligned.
737
738 * Fixed a bug where a tab character inserted after a quote on the same
739 line could add a slash before the quotes.
740
741 This is "before" [tab] and "after" a tab.
742
743 Previously gave this result:
744
745 <p>This is \"before\" [tab] and "after" a tab.</p>
746
747 * Removed a call to `htmlentities`. This fixes a bug where multibyte
748 characters present in the title of a link reference could lead to
749 invalid utf-8 characters.
750
751 * Changed a regular expression in `_TokenizeHTML` that could lead to
752 a segmentation fault with PHP 4.3.8 on Linux.
753
754 * Fixed some notices that could show up if PHP error reporting
755 E_NOTICE flag was set.
756
757
758 Copyright and License
759 ---------------------
760
d3693aa Michel Fortin PHP Markdown 1.0.1e
authored
761 PHP Markdown
14f771a Michel Fortin Bumped version to 1.0.1p.
authored
762 Copyright (c) 2004-2013 Michel Fortin
c634db3 Michel Fortin Changted michelf.com to michelf.ca, as mty website has changed domain.
authored
763 <http://michelf.ca/>
bdcd08b Michel Fortin Base for Object-Oriented PHP Markdown
authored
764 All rights reserved.
765
766 Based on Markdown
d3693aa Michel Fortin PHP Markdown 1.0.1e
authored
767 Copyright (c) 2003-2006 John Gruber
bdcd08b Michel Fortin Base for Object-Oriented PHP Markdown
authored
768 <http://daringfireball.net/>
769 All rights reserved.
770
771 Redistribution and use in source and binary forms, with or without
772 modification, are permitted provided that the following conditions are
773 met:
774
775 * Redistributions of source code must retain the above copyright notice,
776 this list of conditions and the following disclaimer.
777
778 * Redistributions in binary form must reproduce the above copyright
779 notice, this list of conditions and the following disclaimer in the
780 documentation and/or other materials provided with the distribution.
781
782 * Neither the name "Markdown" nor the names of its contributors may
783 be used to endorse or promote products derived from this software
784 without specific prior written permission.
785
786 This software is provided by the copyright holders and contributors "as
787 is" and any express or implied warranties, including, but not limited
788 to, the implied warranties of merchantability and fitness for a
789 particular purpose are disclaimed. In no event shall the copyright owner
790 or contributors be liable for any direct, indirect, incidental, special,
791 exemplary, or consequential damages (including, but not limited to,
792 procurement of substitute goods or services; loss of use, data, or
793 profits; or business interruption) however caused and on any theory of
794 liability, whether in contract, strict liability, or tort (including
795 negligence or otherwise) arising in any way out of the use of this
796 software, even if advised of the possibility of such damage.
Something went wrong with that request. Please try again.