Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 125 lines (89 sloc) 4.542 kB
b3bd8fc @egil Separated changes out to its own class and extended orginal MarkdownE…
authored
1 # PHP Markdown Extra Extended
c3d5a81 @egil Updates to readme
authored
2
b3bd8fc @egil Separated changes out to its own class and extended orginal MarkdownE…
authored
3 An fork of the [PHP Markdown (Extra) project](http://michelf.com/projects/php-markdown/) (<abbr title="PHP Markdown (Extra)">PME</abbr>), extended with extra syntax, especially focused on adding support for more HTML attributes to outputted HTML, and for outputting HTML5.
0a771b5 @egil More description of changes in README
authored
4
7f84092 @egil Added support for defining default css classes
authored
5 ## Changes to syntax from PHP Markdown (Extra)
db3e1b5 @egil Updates to README
authored
6 Unless explicitly specified, existing Markdown markup works exactly as it did before. The orginal syntax is documentated here:
7
8 - [Markdown syntax](http://daringfireball.net/projects/markdown/syntax)
9 - [Markdown Extra syntax](http://michelf.com/projects/php-markdown/extra/)
c3d5a81 @egil Updates to readme
authored
10
e1a9c69 @egil update to readme
authored
11 ### Line break generates a `<br />`
12 In <abbr title="PHP Markdown (Extra)">PME</abbr>, when you want to insert a `<br />` break tag using Markdown, you end a line with two or more spaces, then type return. This turned out to be more annoying than helpful in my projects, so now you just have to type return. This is also how Markdown works with <abbr title="GitHub Flavored Markdown">GFM</abbr>.
0a771b5 @egil More description of changes in README
authored
13
e1a9c69 @egil update to readme
authored
14 Two returns does not insert a `<br />`, but instead creates a new paragraph as usual.
0a771b5 @egil More description of changes in README
authored
15
f84a624 @egil updates to readme
authored
16 ### Support for *cite* attribute on blockquotes
17 It is now possible to add the optional *cite* attribute to the *blockquote* element.
0a771b5 @egil More description of changes in README
authored
18
19 The new, optional, syntax is:
20
21 ```markdown
70a146c @egil Added first changes to the orginal markdown.php, support for cite and…
authored
22 > (cite url) Cited content follows ...
0a771b5 @egil More description of changes in README
authored
23 ```
24
25 #### Example:
26
27 ```markdown
385615e @egil More description of changes in README
authored
28 > (http://www.whatwg.org/) Content inside a blockquote must be quoted
29 > from another source, whose address, if it has one,
30 > may be cited in the `cite` attribute.
0a771b5 @egil More description of changes in README
authored
31 ```
32
33 Will result in the following HTML:
34
b3bd8fc @egil Separated changes out to its own class and extended orginal MarkdownE…
authored
35 ```html
385615e @egil More description of changes in README
authored
36 <blockquote cite="http://www.whatwg.org/">
37 <p>Content inside a blockquote must be quoted
38 from another source, whose address, if it has one,
70a146c @egil Added first changes to the orginal markdown.php, support for cite and…
authored
39 may be cited in the `cite` attribute.</p>
40 </blockquote>
b3bd8fc @egil Separated changes out to its own class and extended orginal MarkdownE…
authored
41 ```
42
43 #### Breaking changes from <abbr title="PHP Markdown (Extra)">PME</abbr>
f84a624 @egil updates to readme
authored
44 The existing rules for and [formatting options](http://daringfireball.net/projects/markdown/syntax#blockquote) for blockquotes still apply. There is one small breaking changes with this addition. If your quote starts with "(" you have two have at least two spaces between the initial ">" and the "(". E.g.:
b3bd8fc @egil Separated changes out to its own class and extended orginal MarkdownE…
authored
45
46 ```markdown
47 > (Ut brisket flank salami.) Cow cupidatat ex t-bone sirloin id.
48 > Sunt flank pastrami spare ribs sint id, nulla nisi.
49 ```
f84a624 @egil updates to readme
authored
50
b3bd8fc @egil Separated changes out to its own class and extended orginal MarkdownE…
authored
51 Will result in the following HTML:
52
53 ```html
54 <blockquote>
55 <p>(Ut brisket flank salami.) Cow cupidatat ex t-bone sirloin id.<br>
56 Sunt flank pastrami spare ribs sint id, nulla nisi.</p>
57 </blockquote>
58 ```
59
60 ### Fenced code block with language support and alternating fence markers (```)
61 It is now possible to specify the language type of a code block, and use an alternatinge fence markers (```), enabling the same syntax as that of <abbr title="GitHub Flavored Markdown">GFM</abbr>.
62
0b973c3 @egil Clean up, updates to README
authored
63 This addition follows the [suggested way](http://dev.w3.org/html5/spec-author-view/the-code-element.html#the-code-element) to specify language by W3C.
64
b3bd8fc @egil Separated changes out to its own class and extended orginal MarkdownE…
authored
65 #### Example:
66
cc762ee @egil Fixes to syntax in README
authored
67 ~~~html
68 <p>Ut brisket flank salami. Cow cupidatat ex t-bone sirloin id.</p>
69 ~~~
b3bd8fc @egil Separated changes out to its own class and extended orginal MarkdownE…
authored
70
71 Using alternative fence markers:
72
cc762ee @egil Fixes to syntax in README
authored
73 ```html
74 <p>Ut brisket flank salami. Cow cupidatat ex t-bone sirloin id.</p>
75 ```
b3bd8fc @egil Separated changes out to its own class and extended orginal MarkdownE…
authored
76
77 Both will output the following HTML:
78
79 ```HTML
80 <pre><code class="language-html">
81 <p>Ut brisket flank salami. Cow cupidatat ex t-bone sirloin id.</p>
82 </code></pre>
83 ```
7f84092 @egil Added support for defining default css classes
authored
84
0dbbfc0 @egil Added experimental support for <figure> and <figcaption>, updates to …
authored
85 ### Support for *figure* and *figcaption* tags
86 There is now experimental support for the the HTML5 tags *[figure](http://dev.w3.org/html5/markup/figure.html)* and *[figcaption](http://dev.w3.org/html5/markup/figcaption.html)*.
87
88 A *figure* is a block level element and is created by wrapping some other content in three or more equal (=) signs.
89
90 A optional *figure caption* can be added to either the top of the figure or the bottom at the figure, right after the equal signs, wrapped in [ and ] signs.
91
92 #### Examples
93 This example shows a *figure* without a caption:
feede9d @egil Fix readme
authored
94
0dbbfc0 @egil Added experimental support for <figure> and <figcaption>, updates to …
authored
95 ```markdown
96 ===
97 ![](img/reference.png)
98 ===
99 ```
feede9d @egil Fix readme
authored
100
0dbbfc0 @egil Added experimental support for <figure> and <figcaption>, updates to …
authored
101 This example shows a *figure* with a caption added before the content:
feede9d @egil Fix readme
authored
102
0dbbfc0 @egil Added experimental support for <figure> and <figcaption>, updates to …
authored
103 ```markdown
104 === [A **happy face** is good for web developers]
105 ![](img/reference.png)
106 ===
107 ```
feede9d @egil Fix readme
authored
108
0dbbfc0 @egil Added experimental support for <figure> and <figcaption>, updates to …
authored
109 This example shows a *figure* with a caption added after the content:
feede9d @egil Fix readme
authored
110
0dbbfc0 @egil Added experimental support for <figure> and <figcaption>, updates to …
authored
111 ```markdown
112 ===
113 ![](img/reference.png)
f84a624 @egil updates to readme
authored
114 === [A **happy face** is good for web developers]
115 ```
0dbbfc0 @egil Added experimental support for <figure> and <figcaption>, updates to …
authored
116
8d0e9d4 @egil testing site, small changes to readme and code
authored
117 ## Usage
118 You need both the *markdown.php* and the *markdown_extended.php* files, but only needs to include *markdown_extended.php*.
119
2fcd7ab @egil Update to readme
authored
120 ```PHP
8d0e9d4 @egil testing site, small changes to readme and code
authored
121 require_once('markdown_extended.php');
122
123 // Convert markdown formatted text in $markdown to HTML
124 $html = MarkdownExtended($markdown);
7f84092 @egil Added support for defining default css classes
authored
125 ```
Something went wrong with that request. Please try again.