maruku 0.5.9 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. data/bin/maruku +6 -1
  2. data/bin/marutest +25 -18
  3. data/lib/maruku.rb +3 -0
  4. data/lib/maruku/ext/div.rb +39 -6
  5. data/lib/maruku/ext/math/latex_fix.rb +1 -0
  6. data/lib/maruku/ext/math/mathml_engines/blahtex.rb +9 -8
  7. data/lib/maruku/ext/math/parsing.rb +15 -1
  8. data/lib/maruku/ext/math/to_html.rb +34 -17
  9. data/lib/maruku/ext/math/to_latex.rb +4 -0
  10. data/lib/maruku/helpers.rb +3 -3
  11. data/lib/maruku/input/charsource.rb +1 -1
  12. data/lib/maruku/input/parse_block.rb +1 -0
  13. data/lib/maruku/input/parse_doc.rb +12 -5
  14. data/lib/maruku/input/parse_span_better.rb +24 -10
  15. data/lib/maruku/output/s5/to_s5.rb +14 -1
  16. data/lib/maruku/output/to_html.rb +20 -1
  17. data/lib/maruku/output/to_latex.rb +27 -0
  18. data/lib/maruku/output/to_latex_entities.rb +2 -2
  19. data/lib/maruku/output/to_s.rb +5 -2
  20. data/lib/maruku/string_utils.rb +2 -2
  21. data/lib/maruku/structures.rb +2 -0
  22. data/lib/maruku/tests/new_parser.rb +5 -2
  23. data/lib/maruku/version.rb +1 -1
  24. data/tests/bugs/code_in_links.md +85 -0
  25. data/tests/bugs/complex_escaping.md +34 -0
  26. data/tests/unittest/abbreviations.md +2 -10
  27. data/tests/unittest/alt.md +2 -3
  28. data/tests/unittest/attributes/att2.md +2 -4
  29. data/tests/unittest/attributes/att3.md +2 -7
  30. data/tests/unittest/attributes/attributes.md +2 -15
  31. data/tests/unittest/attributes/circular.md +2 -7
  32. data/tests/unittest/attributes/default.md +2 -6
  33. data/tests/unittest/blank.md +2 -5
  34. data/tests/unittest/blanks_in_code.md +2 -21
  35. data/tests/unittest/bug_def.md +2 -3
  36. data/tests/unittest/bug_table.md +2 -11
  37. data/tests/unittest/code.md +2 -9
  38. data/tests/unittest/code2.md +2 -8
  39. data/tests/unittest/code3.md +2 -21
  40. data/tests/unittest/data_loss.md +2 -7
  41. data/tests/unittest/divs/div1.md +32 -57
  42. data/tests/unittest/divs/div2.md +6 -7
  43. data/tests/unittest/divs/div3_nest.md +8 -13
  44. data/tests/unittest/easy.md +2 -3
  45. data/tests/unittest/email.md +2 -3
  46. data/tests/unittest/encoding/iso-8859-1.md +2 -5
  47. data/tests/unittest/encoding/utf-8.md +2 -5
  48. data/tests/unittest/entities.md +2 -20
  49. data/tests/unittest/escaping.md +2 -12
  50. data/tests/unittest/extra_dl.md +2 -10
  51. data/tests/unittest/extra_header_id.md +2 -13
  52. data/tests/unittest/extra_table1.md +2 -8
  53. data/tests/unittest/footnotes.md +2 -19
  54. data/tests/{bugs/html.md → unittest/hang.md} +9 -9
  55. data/tests/unittest/headers.md +2 -7
  56. data/tests/unittest/hex_entities.md +2 -3
  57. data/tests/unittest/hrule.md +2 -11
  58. data/tests/unittest/html2.md +2 -6
  59. data/tests/unittest/html3.md +2 -6
  60. data/tests/unittest/html4.md +2 -7
  61. data/tests/unittest/html5.md +2 -5
  62. data/tests/unittest/ie.md +2 -23
  63. data/tests/unittest/images.md +2 -14
  64. data/tests/unittest/images2.md +2 -5
  65. data/tests/unittest/inline_html.md +6 -102
  66. data/tests/unittest/inline_html2.md +2 -5
  67. data/tests/unittest/links.md +17 -50
  68. data/tests/unittest/links2.md +2 -3
  69. data/tests/unittest/list1.md +2 -10
  70. data/tests/unittest/list12.md +2 -5
  71. data/tests/unittest/list2.md +2 -10
  72. data/tests/unittest/list3.md +2 -14
  73. data/tests/unittest/list4.md +2 -17
  74. data/tests/unittest/lists.md +2 -39
  75. data/tests/unittest/lists10.md +2 -7
  76. data/tests/unittest/lists11.md +2 -5
  77. data/tests/unittest/lists6.md +2 -3
  78. data/tests/unittest/lists9.md +2 -11
  79. data/tests/unittest/lists_after_paragraph.md +3 -51
  80. data/tests/unittest/lists_ol.md +2 -52
  81. data/tests/unittest/loss.md +2 -3
  82. data/tests/unittest/math/equations.md +54 -37
  83. data/tests/unittest/math/inline.md +4 -12
  84. data/tests/unittest/math/math2.md +4 -57
  85. data/tests/unittest/math/notmath.md +2 -5
  86. data/tests/unittest/math/table.md +5 -11
  87. data/tests/unittest/math/table2.md +2 -8
  88. data/tests/unittest/misc_sw.md +2 -80
  89. data/tests/unittest/notyet/escape.md +2 -5
  90. data/tests/unittest/notyet/header_after_par.md +2 -13
  91. data/tests/unittest/notyet/ticks.md +2 -3
  92. data/tests/unittest/notyet/triggering.md +2 -39
  93. data/tests/unittest/olist.md +2 -9
  94. data/tests/unittest/one.md +2 -3
  95. data/tests/unittest/paragraph.md +2 -3
  96. data/tests/unittest/paragraph_rules/dont_merge_ref.md +2 -5
  97. data/tests/unittest/paragraph_rules/tab_is_blank.md +2 -5
  98. data/tests/unittest/paragraphs.md +2 -10
  99. data/tests/unittest/pending/amps.md +2 -4
  100. data/tests/unittest/pending/empty_cells.md +2 -6
  101. data/tests/unittest/pending/link.md +2 -21
  102. data/tests/unittest/pending/ref.md +2 -3
  103. data/tests/unittest/recover/recover_links.md +7 -8
  104. data/tests/{bugs → unittest/red_tests}/abbrev.md +12 -103
  105. data/tests/unittest/{lists7.md → red_tests/lists7.md} +2 -13
  106. data/tests/unittest/{lists7b.md → red_tests/lists7b.md} +2 -10
  107. data/tests/unittest/{lists8.md → red_tests/lists8.md} +2 -9
  108. data/tests/unittest/red_tests/xml.md +70 -0
  109. data/tests/unittest/references/long_example.md +2 -7
  110. data/tests/unittest/references/spaces_and_numbers.md +2 -3
  111. data/tests/unittest/smartypants.md +2 -47
  112. data/tests/unittest/syntax_hl.md +2 -18
  113. data/tests/unittest/table_attributes.md +2 -8
  114. data/tests/unittest/test.md +2 -3
  115. data/tests/unittest/underscore_in_words.md +27 -0
  116. data/tests/unittest/wrapping.md +2 -11
  117. data/tests/unittest/xml2.md +2 -5
  118. data/tests/unittest/xml3.md +2 -8
  119. data/tests/unittest/xml_instruction.md +2 -10
  120. data/unit_test_span.sh +2 -1
  121. metadata +242 -241
  122. data/docs/changelog.html +0 -490
  123. data/docs/entity_test.html +0 -258
  124. data/docs/exd.html +0 -307
  125. data/docs/index.html +0 -332
  126. data/docs/markdown_syntax.html +0 -690
  127. data/docs/maruku.html +0 -332
  128. data/docs/proposal.html +0 -326
  129. data/docs/tmp.md +0 -2
  130. data/lib/sort_prof.rb +0 -22
  131. data/tests/bugs/links.md +0 -47
  132. data/tests/diagrams/diagrams.md +0 -302
  133. data/tests/s5/a.md +0 -13
  134. data/tests/s5/instiki+s5.md +0 -105
  135. data/tests/unittest/xml.md +0 -54
data/docs/index.html DELETED
@@ -1,332 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!DOCTYPE html PUBLIC
3
- "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
4
- "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
5
- <html xmlns:svg='http://www.w3.org/2000/svg' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
6
- <head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title>Maruku: a Markdown-superset interpreter</title><link href='style.css' rel='stylesheet' type='text/css' />
7
- </head>
8
- <body>
9
- <p><img src='logo.png' id='logo' alt='MaRuKu' /></p>
10
-
11
- <h1 id='maruku_a_markdownsuperset_interpreter'>Mar<strong>u</strong>k<strong>u</strong>: a Markdown-superset interpreter</h1>
12
-
13
- <p><a href='http://maruku.rubyforge.org/'>Maruku</a> is a Markdown interpreter written in <a href='http://www.ruby-lang.org'>Ruby</a>.</p>
14
-
15
- <blockquote id='news'>
16
- <p><a href='#release_notes'>Last release</a> is version 0.5.6 &#8211; 2007-05-22.</p>
17
-
18
- <p>Install using <a href='http://rubygems.org'>rubygems</a>:</p>
19
-
20
- <pre><code>$ gem install maruku</code></pre>
21
-
22
- <p>Use this command to update to latest version:</p>
23
-
24
- <pre><code>$ gem update maruku</code></pre>
25
- </blockquote>
26
- <hr />
27
- <p>Maruku allows you to write in an easy-to-read-and-write syntax, like this:</p>
28
-
29
- <blockquote>
30
- <p><a href='http://maruku.rubyforge.org/maruku.md'>This document in Markdown</a></p>
31
- </blockquote>
32
-
33
- <p>Then it can be translated to HTML:</p>
34
-
35
- <blockquote>
36
- <p><a href='http://maruku.rubyforge.org/maruku.html'>This document in HTML</a></p>
37
- </blockquote>
38
-
39
- <p>or LaTeX, which is then converted to PDF:</p>
40
-
41
- <blockquote>
42
- <p><a href='http://maruku.rubyforge.org/maruku.pdf'>This document in PDF</a></p>
43
- </blockquote>
44
-
45
- <p>Maruku implements:</p>
46
-
47
- <ul>
48
- <li>
49
- <p>the original <a href='http://maruku.rubyforge.org/markdown_syntax.html'>Markdown syntax</a> (<a href='http://maruku.rubyforge.org/markdown_syntax.html'>HTML</a> or <a href='http://maruku.rubyforge.org/markdown_syntax.pdf'>PDF</a>), translated by Maruku).</p>
50
- </li>
51
-
52
- <li>
53
- <p>all the improvements in <a href='http://www.michelf.com/projects/php-markdown/extra/'>PHP Markdown Extra</a>.</p>
54
- </li>
55
-
56
- <li>
57
- <p>a new <a href='http://maruku.rubyforge.org/proposal.html'>meta-data syntax</a></p>
58
- </li>
59
- </ul>
60
-
61
- <p><strong>Authors</strong>: Maruku has been developed so far by <a href='http://www.dis.uniroma1.it/~acensi/'>Andrea Censi</a>. Contributors are most welcome!</p>
62
-
63
- <p><strong>The name of the game</strong>: Maruku is the <a href='http://en.wikipedia.org/wiki/Romaji'>romaji</a> transliteration of the <a href='http://en.wikipedia.org/wiki/Katakana'>katakana</a> transliteration of &#8220;Mark&#8221;, the first word in Markdown. I chose this name because Ruby is Japanese, and also the sillable &#8220;ru&#8221; appears in Maruku.</p>
64
- <hr />
65
- <p>Table of contents: (<strong>auto-generated by Maruku!</strong>)</p>
66
- <div class='maruku_toc'><ul style='list-style: none;'><li><span class='maruku_section_number'>1. </span><a href='#release_notes'>Release notes</a></li><li><span class='maruku_section_number'>2. </span><a href='#download'>Download</a><ul style='list-style: none;'><li><span class='maruku_section_number'>2.1. </span><a href='#bugs_report'>Bugs report</a></li></ul></li><li><span class='maruku_section_number'>3. </span><a href='#usage'>Usage</a><ul style='list-style: none;'><li><span class='maruku_section_number'>3.1. </span><a href='#embedded_maruku'>Embedded Maruku</a></li><li><span class='maruku_section_number'>3.2. </span><a href='#from_the_command_line'>From the command line</a></li></ul></li><li><span class='maruku_section_number'>4. </span><a href='#maruku-and-bluecloth'>Maruku and Bluecloth</a></li><li><span class='maruku_section_number'>5. </span><a href='#features'>Maruku summary of features</a><ul style='list-style: none;'><li><span class='maruku_section_number'>5.1. </span><a href='#meta'>New meta-data syntax</a></li><li><span class='maruku_section_number'>5.2. </span><a href='#toc-generation'>Automatic generation of the table of contents</a></li><li><span class='maruku_section_number'>5.3. </span><a href='#entities'>Use HTML entities</a></li><li><span class='maruku_section_number'>5.4. </span><a href='#this_header_contains_emphasis_strong_text_and_'>This header contains <em>emphasis</em> <strong>strong text</strong> and <code>code</code></a></li></ul></li><li><span class='maruku_section_number'>6. </span><a href='#extra'>Examples of PHP Markdown Extra syntax</a></li></ul></div><hr />
67
- <h2 id='release_notes'><span class='maruku_section_number'>1. </span>Release notes</h2>
68
-
69
- <p>Note: Maruku seems to be very robust, nevertheless it is still beta-level software. So if you want to use it in production environments, please check back in a month or so, while we squash the remaining bugs.</p>
70
-
71
- <p>In the meantime, feel free to toy around, and please signal problems, request features, by <a href='http://www.dis.uniroma1.it/~acensi/contact.html'>contacting me</a> or using the <a href='http://rubyforge.org/tracker/?group_id=2795'>tracker</a>. For issues about the Markdown syntax itself and improvements to it, please write to the <a href='http://six.pairlist.net/mailman/listinfo/markdown-discuss'>Markdown-discuss mailing list</a>.</p>
72
-
73
- <p>Have fun!</p>
74
-
75
- <p>See the <a href='http://maruku.rubyforge.org/changelog.html#stable'>changelog</a>.</p>
76
-
77
- <h2 id='download'><span class='maruku_section_number'>2. </span>Download</h2>
78
-
79
- <p>The development site is <a href='http://rubyforge.org/projects/maruku/'>http://rubyforge.org/projects/maruku/</a>.</p>
80
-
81
- <p>Install with:</p>
82
-
83
- <pre style='background-color: #efefff;'><code class='sh' lang='sh'>$ gem install maruku</code></pre>
84
-
85
- <p>Released files can also be seen at <a href='http://rubyforge.org/frs/?group_id=2795'>http://rubyforge.org/frs/?group_id=2795</a>.</p>
86
-
87
- <p>Anonymous access to the repository is possible with:</p>
88
-
89
- <pre style='background-color: #efefff;'><code class='sh' lang='sh'>$ svn checkout svn://rubyforge.org/var/svn/maruku/trunk</code></pre>
90
-
91
- <p>If you want commit access to the repository, just create an account on Rubyforge and <a href='http://www.dis.uniroma1.it/~acensi/contact.html'>drop me a mail</a>.</p>
92
-
93
- <h3 id='bugs_report'><span class='maruku_section_number'>2.1. </span>Bugs report</h3>
94
-
95
- <p>Use the <a href='http://rubyforge.org/tracker/?group_id=2795'>tracker</a> or <a href='http://www.dis.uniroma1.it/~acensi/contact.html'>drop me an email</a>.</p>
96
-
97
- <h2 id='usage'><span class='maruku_section_number'>3. </span>Usage</h2>
98
-
99
- <h3 id='embedded_maruku'><span class='maruku_section_number'>3.1. </span>Embedded Maruku</h3>
100
-
101
- <p>This is the basic usage:</p>
102
-
103
- <pre style='background-color: #efffef;'><code class='ruby' lang='ruby'><span class='ident'>require</span> <span class='punct'>&#39;</span><span class='string'>rubygems</span><span class='punct'>&#39;</span>
104
- <span class='ident'>require</span> <span class='punct'>&#39;</span><span class='string'>maruku</span><span class='punct'>&#39;</span>
105
-
106
- <span class='ident'>doc</span> <span class='punct'>=</span> <span class='constant'>Maruku</span><span class='punct'>.</span><span class='ident'>new</span><span class='punct'>(</span><span class='ident'>markdown_string</span><span class='punct'>)</span>
107
- <span class='ident'>puts</span> <span class='ident'>doc</span><span class='punct'>.</span><span class='ident'>to_html</span></code></pre>
108
-
109
- <p>The method <code>to_html</code> outputs only an HTML fragment, while the method <code>to_html_document</code> outputs a complete XHTML 1.0 document:</p>
110
-
111
- <pre style='background-color: #efffef;'><code class='ruby' lang='ruby'><span class='ident'>puts</span> <span class='ident'>doc</span><span class='punct'>.</span><span class='ident'>to_html_document</span></code></pre>
112
-
113
- <p>You can have the REXML document tree with:</p>
114
-
115
- <pre style='background-color: #efffef;'><code class='ruby' lang='ruby'><span class='ident'>tree</span> <span class='punct'>=</span> <span class='ident'>doc</span><span class='punct'>.</span><span class='ident'>to_html_document_tree</span></code></pre>
116
-
117
- <h3 id='from_the_command_line'><span class='maruku_section_number'>3.2. </span>From the command line</h3>
118
-
119
- <p>There is one command-line program installed: <code>maruku</code>.</p>
120
-
121
- <p>Without arguments, it converts Markdown to HTML:</p>
122
-
123
- <pre style='background-color: #efefff;'><code class='sh' lang='sh'>$ maruku file.md # creates file.html</code></pre>
124
-
125
- <p>With the <code>--pdf</code> arguments, it converts Markdown to LaTeX, then calls <code>pdflatex</code> to transform to PDF:</p>
126
-
127
- <pre style='background-color: #efefff;'><code class='sh' lang='sh'>$ maruku --pdf file.md # creates file.tex and file.pdf</code></pre>
128
-
129
- <h2 id='maruku-and-bluecloth'><span class='maruku_section_number'>4. </span>Maruku and Bluecloth</h2>
130
-
131
- <p>The other Ruby implementation of Markdown is <a href='http://www.deveiate.org/projects/BlueCloth'>Bluecloth</a>.</p>
132
-
133
- <p>Maruku is much different in philosophy from Bluecloth: the biggest difference is that <em>parsing</em> is separated from <em>rendering</em>. In Maruku, an in-memory representation of the Markdown document is created. Instead, Bluecloth mantains the document in memory as a String at all times, and does a series of <code>gsub</code> to transform to HTML.</p>
134
-
135
- <p>Maruku is usually faster than Bluecloth. Bluecloth is faster for very small documents. Bluecloth sometimes chokes on very big documents (it is reported that the blame should be on Ruby&#8217;s regexp implementation).</p>
136
-
137
- <p>This is the canonical benchmark (the Markdown specification), executed with Ruby 1.8.5 on a Powerbook 1.5GhZ:</p>
138
-
139
- <pre><code>BlueCloth (to_html): parsing 0.01 sec + rendering 1.87 sec = 1.88 sec (1.00x)
140
- Maruku (to_html): parsing 0.66 sec + rendering 0.43 sec = 1.09 sec (1.73x)
141
- Maruku (to_latex): parsing 0.67 sec + rendering 0.23 sec = 0.90 sec (2.10x)</code></pre>
142
-
143
- <p>Please note that Maruku has a lot more features and therefore is looking for much more patterns in the file.</p>
144
-
145
- <h2 id='features'><span class='maruku_section_number'>5. </span>Maruku summary of features</h2>
146
-
147
- <ul>
148
- <li>
149
- <p>Supported syntax</p>
150
-
151
- <ul>
152
- <li><a href='http://daringfireball.net/projects/markdown/syntax'>Basic Markdown</a></li>
153
-
154
- <li><a href='#extra'>Markdown Extra</a></li>
155
-
156
- <li><a href='#meta'>Meta-data syntax</a></li>
157
- </ul>
158
- </li>
159
-
160
- <li>
161
- <p>Output</p>
162
-
163
- <ul>
164
- <li>
165
- <p>XHTML</p>
166
-
167
- <ul>
168
- <li>Syntax highlighting via the <a href='http://syntax.rubyforge.org/'><code>syntax</code></a> library.</li>
169
- </ul>
170
- </li>
171
-
172
- <li>
173
- <p>LaTeX</p>
174
-
175
- <ul>
176
- <li><a href='#entities'>Translation of HTML entities to LaTeX</a></li>
177
-
178
- <li>Syntax highlighting via the <a href='http://www.ctan.org/tex-archive/macros/latex/contrib/listings/'><code>listings</code></a> package.</li>
179
- </ul>
180
- </li>
181
- </ul>
182
- </li>
183
-
184
- <li>
185
- <p>Misc</p>
186
-
187
- <ul>
188
- <li>
189
- <p><a href='exd.html'>Documentation for supported attributes</a></p>
190
- </li>
191
-
192
- <li>
193
- <p><a href='#toc-generation'>Automatic generation of the TOC</a></p>
194
- </li>
195
- </ul>
196
- </li>
197
- </ul>
198
-
199
- <p><strong>Experimental features (not released yet)</strong></p>
200
-
201
- <ul>
202
- <li><a href='http://maruku.rubyforge.org/math.xhtml'>LaTeX Math syntax</a> (not enabled by default)</li>
203
-
204
- <li>An extension system for adding new syntax is available, but the API is bound to change in the future, so please don&#8217;t use it.</li>
205
-
206
- <li>LaTeX to MathML using either one of <a href='http://ritex.rubyforge.org'><code>ritex</code></a>, <a href='http://golem.ph.utexas.edu/~distler/code/itexToMML/'><code>itex2mml</code></a>, <a href='http://www.blahtex.org'><code>blahtex</code></a>.</li>
207
-
208
- <li>LaTeX to PNG using <a href='http://www.blahtex.org'><code>blahtex</code></a>.</li>
209
- </ul>
210
-
211
- <h3 id='meta'><span class='maruku_section_number'>5.1. </span>New meta-data syntax</h3>
212
-
213
- <p>Maruku implements a syntax that allows to attach &#8220;meta&#8221; information to objects.</p>
214
-
215
- <p>See <a href='http://maruku.rubyforge.org/proposal.html'>this proposal</a> for how to attach metadata to the elements.</p>
216
-
217
- <p>See the <a href='exd.html'>documentation for supported attributes</a>.</p>
218
-
219
- <p>Meta-data for the document itself is specified through the use of email headers:</p>
220
-
221
- <pre style='background-color: #ffefef;'><code>Title: A simple document containing meta-headers
222
- CSS: style.css
223
-
224
- Content of the document</code></pre>
225
-
226
- <p>When creating the document through</p>
227
-
228
- <pre style='background-color: #efffef;'><code class='ruby' lang='ruby'><span class='constant'>Maruku</span><span class='punct'>.</span><span class='ident'>new</span><span class='punct'>(</span><span class='ident'>s</span><span class='punct'>).</span><span class='ident'>to_html_document</span></code></pre>
229
-
230
- <p>the title and stylesheet are added as expected.</p>
231
-
232
- <p>Meta-data keys are assumed to be case-insensitive.</p>
233
-
234
- <h3 id='toc-generation'><span class='maruku_section_number'>5.2. </span>Automatic generation of the table of contents</h3>
235
-
236
- <p>If you create a list, and then set the <code>toc</code> attribute, when rendering Maruku will create an auto-generated table of contents.</p>
237
-
238
- <pre><code>* This will become a table of contents (this text will be scraped).
239
- {:toc}</code></pre>
240
-
241
- <p>You can see an example of this at the beginning of this document.</p>
242
-
243
- <h3 id='entities'><span class='maruku_section_number'>5.3. </span>Use HTML entities</h3>
244
-
245
- <p>If you want to use HTML entities, go on! We will take care of the translation to LaTeX:</p>
246
- <table><thead><tr><th>Entity</th><th>Result</th></tr></thead><tbody><tr><td style='text-align: left;'><code>&amp;copy;</code></td><td style='text-align: left;'>&#169;</td>
247
- </tr><tr><td style='text-align: left;'><code>&amp;pound;</code></td><td style='text-align: left;'>&#163;</td>
248
- </tr><tr><td style='text-align: left;'><code>&amp;lambda;</code></td><td style='text-align: left;'>&#955;</td>
249
- </tr><tr><td style='text-align: left;'><code>&amp;mdash;</code></td><td style='text-align: left;'>&#8212;</td>
250
- </tr></tbody></table>
251
- <p>See the <a href='http://maruku.rubyforge.org/entity_test.html'>list of supported entities</a> (<a href='http://maruku.rubyforge.org/entity_test.pdf'>pdf</a>).</p>
252
-
253
- <h3 id='this_header_contains_emphasis_strong_text_and_'><span class='maruku_section_number'>5.4. </span>This header contains <em>emphasis</em> <strong>strong text</strong> and <code>code</code></h3>
254
-
255
- <p>Note that this header contains formatting and it still works, also in the table of contents.</p>
256
-
257
- <p>And <a href='#features'>This is a <em>link</em> with <strong>all</strong> <strong><em>sort</em></strong> of <code>weird stuff</code></a> in the text.</p>
258
-
259
- <h2 id='extra'><span class='maruku_section_number'>6. </span>Examples of PHP Markdown Extra syntax</h2>
260
-
261
- <ul>
262
- <li>
263
- <p>tables</p>
264
-
265
- <pre style='background-color: #ffefef;'><code>Col1 | Very very long head | Very very long head|
266
- -----|:-------------------:|-------------------:|
267
- cell | center-align | right-align |</code></pre>
268
- <table><thead><tr><th>Col1</th><th>Very very long head</th><th>Very very long head</th></tr></thead><tbody><tr><td style='text-align: left;'>cell</td><td style='text-align: center;'>center-align</td><td style='text-align: right;'>right-align</td>
269
- </tr></tbody></table></li>
270
-
271
- <li>
272
- <p>footnotes <sup id='fnref:1'><a href='#fn:1' rel='footnote'>1</a></sup></p>
273
-
274
- <pre style='background-color: #ffefef;'><code>* footnotes [^foot]
275
-
276
- [^foot]: I really was missing those.</code></pre>
277
- </li>
278
- </ul>
279
-
280
- <ul>
281
- <li>
282
- <p>Markdown inside HTML elements</p>
283
-
284
- <pre><code class='xml' lang='xml'><span class='punct'>&lt;</span><span class='tag'>div</span> <span class='attribute'>markdown</span><span class='punct'>=&quot;</span><span class='string'>1</span><span class='punct'>&quot;</span> <span class='attribute'>style</span><span class='punct'>=&quot;</span><span class='string'>border: solid 1px black</span><span class='punct'>&quot;&gt;</span>
285
- This is a div with Markdown **strong text**
286
- <span class='punct'>&lt;/</span><span class='tag'>div</span><span class='punct'>&gt;</span></code></pre>
287
- <div style='border: solid 1px black'>
288
- <p>This is a div with Markdown <strong>strong text</strong></p>
289
- </div></li>
290
-
291
- <li>
292
- <p>header ids</p>
293
-
294
- <pre style='background-color: #ffefef;'><code>## Download ## {#download}</code></pre>
295
-
296
- <p>For example, <a href='#download'>a link to the download</a> header.</p>
297
- </li>
298
-
299
- <li>
300
- <p>definition lists</p>
301
-
302
- <pre style='background-color: #ffefef;'><code>Definition list
303
- : something very hard to parse</code></pre>
304
-
305
- <dl>
306
- <dt>Definition list</dt>
307
-
308
- <dd>something very hard to parse</dd>
309
- </dl>
310
- </li>
311
-
312
- <li>
313
- <p>abbreviations or <abbr title='Simply an abbreviation'>ABB</abbr> for short.</p>
314
- </li>
315
- </ul>
316
- <script src='http://www.google-analytics.com/urchin.js' type='text/javascript'>
317
- </script><script type='text/javascript'>
318
- _uacct = "UA-155626-2";
319
- urchinTracker();
320
- </script><!--
321
- Future developments {#future}
322
-
323
- I think that [Pandoc] and [MultiMarkdown] are very cool projects.
324
- However, they are written in Haskell and Perl, respectively.
325
- I would love to have an equivalent in Ruby.
326
-
327
- [Pandoc]: http://sophos.berkeley.edu/macfarlane/pandoc/
328
- [MultiMarkdown]: http://fletcher.freeshell.org/wiki/MultiMarkdown
329
-
330
- --><div class='footnotes'><hr /><ol><li id='fn:1'>
331
- <p>I really was missing those.</p>
332
- <a href='#fnref:1' rev='footnote'>&#8617;</a></li></ol></div></body></html>
@@ -1,690 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!DOCTYPE html PUBLIC
3
- "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
4
- "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
5
- <html xmlns:svg='http://www.w3.org/2000/svg' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
6
- <head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title>Markdown: Syntax</title><link href='style.css' rel='stylesheet' type='text/css' />
7
- </head>
8
- <body>
9
- <h1 id='markdown_syntax'>Markdown: Syntax</h1>
10
- <ul id='ProjectSubmenu'>
11
- <li><a href='/projects/markdown/' title='Markdown Project Page'>Main</a></li>
12
- <li><a href='/projects/markdown/basics' title='Markdown Basics'>Basics</a></li>
13
- <li><a class='selected' title='Markdown Syntax Documentation'>Syntax</a></li>
14
- <li><a href='/projects/markdown/license' title='Pricing and License Information'>License</a></li>
15
- <li><a href='/projects/markdown/dingus' title='Online Markdown Web Form'>Dingus</a></li>
16
- </ul>
17
- <ul>
18
- <li>
19
- <p><a href='#overview'>Overview</a></p>
20
-
21
- <ul>
22
- <li><a href='#philosophy'>Philosophy</a></li>
23
-
24
- <li><a href='#html'>Inline HTML</a></li>
25
-
26
- <li><a href='#autoescape'>Automatic Escaping for Special Characters</a></li>
27
- </ul>
28
- </li>
29
-
30
- <li>
31
- <p><a href='#block'>Block Elements</a></p>
32
-
33
- <ul>
34
- <li><a href='#p'>Paragraphs and Line Breaks</a></li>
35
-
36
- <li><a href='#header'>Headers</a></li>
37
-
38
- <li><a href='#blockquote'>Blockquotes</a></li>
39
-
40
- <li><a href='#list'>Lists</a></li>
41
-
42
- <li><a href='#precode'>Code Blocks</a></li>
43
-
44
- <li><a href='#hr'>Horizontal Rules</a></li>
45
- </ul>
46
- </li>
47
-
48
- <li>
49
- <p><a href='#span'>Span Elements</a></p>
50
-
51
- <ul>
52
- <li><a href='#link'>Links</a></li>
53
-
54
- <li><a href='#em'>Emphasis</a></li>
55
-
56
- <li><a href='#code'>Code</a></li>
57
-
58
- <li><a href='#img'>Images</a></li>
59
- </ul>
60
- </li>
61
-
62
- <li>
63
- <p><a href='#misc'>Miscellaneous</a></p>
64
-
65
- <ul>
66
- <li><a href='#backslash'>Backslash Escapes</a></li>
67
-
68
- <li><a href='#autolink'>Automatic Links</a></li>
69
- </ul>
70
- </li>
71
- </ul>
72
-
73
- <p><strong>Note:</strong> This document is itself written using Markdown; you can <a href='/projects/markdown/syntax.text'>see the source for it by adding &#8216;.text&#8217; to the URL</a>.</p>
74
- <hr /><h2 id='overview'>Overview</h2><h3 id='philosophy'>Philosophy</h3>
75
- <p>Markdown is intended to be as easy-to-read and easy-to-write as is feasible.</p>
76
-
77
- <p>Readability, however, is emphasized above all else. A Markdown-formatted document should be publishable as-is, as plain text, without looking like it&#8217;s been marked up with tags or formatting instructions. While Markdown&#8217;s syntax has been influenced by several existing text-to-HTML filters &#8211; including <a href='http://docutils.sourceforge.net/mirror/setext.html'>Setext</a>, <a href='http://www.aaronsw.com/2002/atx/'>atx</a>, <a href='http://textism.com/tools/textile/'>Textile</a>, <a href='http://docutils.sourceforge.net/rst.html'>reStructuredText</a>, <a href='http://www.triptico.com/software/grutatxt.html'>Grutatext</a>, and <a href='http://ettext.taint.org/doc/'>EtText</a> &#8211; the single biggest source of inspiration for Markdown&#8217;s syntax is the format of plain text email.</p>
78
-
79
- <p>To this end, Markdown&#8217;s syntax is comprised entirely of punctuation characters, which punctuation characters have been carefully chosen so as to look like what they mean. E.g., asterisks around a word actually look like *emphasis*. Markdown lists look like, well, lists. Even blockquotes look like quoted passages of text, assuming you&#8217;ve ever used email.</p>
80
- <h3 id='html'>Inline HTML</h3>
81
- <p>Markdown&#8217;s syntax is intended for one purpose: to be used as a format for <em>writing</em> for the web.</p>
82
-
83
- <p>Markdown is not a replacement for HTML, or even close to it. Its syntax is very small, corresponding only to a very small subset of HTML tags. The idea is <em>not</em> to create a syntax that makes it easier to insert HTML tags. In my opinion, HTML tags are already easy to insert. The idea for Markdown is to make it easy to read, write, and edit prose. HTML is a <em>publishing</em> format; Markdown is a <em>writing</em> format. Thus, Markdown&#8217;s formatting syntax only addresses issues that can be conveyed in plain text.</p>
84
-
85
- <p>For any markup that is not covered by Markdown&#8217;s syntax, you simply use HTML itself. There&#8217;s no need to preface it or delimit it to indicate that you&#8217;re switching from Markdown to HTML; you just use the tags.</p>
86
-
87
- <p>The only restrictions are that block-level HTML elements &#8211; e.g. <code>&lt;div&gt;</code>, <code>&lt;table&gt;</code>, <code>&lt;pre&gt;</code>, <code>&lt;p&gt;</code>, etc. &#8211; must be separated from surrounding content by blank lines, and the start and end tags of the block should not be indented with tabs or spaces. Markdown is smart enough not to add extra (unwanted) <code>&lt;p&gt;</code> tags around HTML block-level tags.</p>
88
-
89
- <p>For example, to add an HTML table to a Markdown article:</p>
90
-
91
- <pre><code>This is a regular paragraph.
92
-
93
- &lt;table&gt;
94
- &lt;tr&gt;
95
- &lt;td&gt;Foo&lt;/td&gt;
96
- &lt;/tr&gt;
97
- &lt;/table&gt;
98
-
99
- This is another regular paragraph.</code></pre>
100
-
101
- <p>Note that Markdown formatting syntax is not processed within block-level HTML tags. E.g., you can&#8217;t use Markdown-style <code>*emphasis*</code> inside an HTML block.</p>
102
-
103
- <p>Span-level HTML tags &#8211; e.g. <code>&lt;span&gt;</code>, <code>&lt;cite&gt;</code>, or <code>&lt;del&gt;</code> &#8211; can be used anywhere in a Markdown paragraph, list item, or header. If you want, you can even use HTML tags instead of Markdown formatting; e.g. if you&#8217;d prefer to use HTML <code>&lt;a&gt;</code> or <code>&lt;img&gt;</code> tags instead of Markdown&#8217;s link or image syntax, go right ahead.</p>
104
-
105
- <p>Unlike block-level HTML tags, Markdown syntax <em>is</em> processed within span-level tags.</p>
106
- <h3 id='autoescape'>Automatic Escaping for Special Characters</h3>
107
- <p>In HTML, there are two characters that demand special treatment: <code>&lt;</code> and <code>&amp;</code>. Left angle brackets are used to start tags; ampersands are used to denote HTML entities. If you want to use them as literal characters, you must escape them as entities, e.g. <code>&amp;lt;</code>, and <code>&amp;amp;</code>.</p>
108
-
109
- <p>Ampersands in particular are bedeviling for web writers. If you want to write about &#8216;AT&amp;T&#8217;, you need to write &#8217;<code>AT&amp;amp;T</code>&#8217;. You even need to escape ampersands within URLs. Thus, if you want to link to:</p>
110
-
111
- <pre><code>http://images.google.com/images?num=30&amp;q=larry+bird</code></pre>
112
-
113
- <p>you need to encode the URL as:</p>
114
-
115
- <pre><code>http://images.google.com/images?num=30&amp;amp;q=larry+bird</code></pre>
116
-
117
- <p>in your anchor tag <code>href</code> attribute. Needless to say, this is easy to forget, and is probably the single most common source of HTML validation errors in otherwise well-marked-up web sites.</p>
118
-
119
- <p>Markdown allows you to use these characters naturally, taking care of all the necessary escaping for you. If you use an ampersand as part of an HTML entity, it remains unchanged; otherwise it will be translated into <code>&amp;amp;</code>.</p>
120
-
121
- <p>So, if you want to include a copyright symbol in your article, you can write:</p>
122
-
123
- <pre><code>&amp;copy;</code></pre>
124
-
125
- <p>and Markdown will leave it alone. But if you write:</p>
126
-
127
- <pre><code>AT&amp;T</code></pre>
128
-
129
- <p>Markdown will translate it to:</p>
130
-
131
- <pre><code>AT&amp;amp;T</code></pre>
132
-
133
- <p>Similarly, because Markdown supports <a href='#html'>inline HTML</a>, if you use angle brackets as delimiters for HTML tags, Markdown will treat them as such. But if you write:</p>
134
-
135
- <pre><code>4 &lt; 5</code></pre>
136
-
137
- <p>Markdown will translate it to:</p>
138
-
139
- <pre><code>4 &amp;lt; 5</code></pre>
140
-
141
- <p>However, inside Markdown code spans and blocks, angle brackets and ampersands are <em>always</em> encoded automatically. This makes it easy to use Markdown to write about HTML code. (As opposed to raw HTML, which is a terrible format for writing about HTML syntax, because every single <code>&lt;</code> and <code>&amp;</code> in your example code needs to be escaped.)</p>
142
- <hr /><h2 id='block'>Block Elements</h2><h3 id='p'>Paragraphs and Line Breaks</h3>
143
- <p>A paragraph is simply one or more consecutive lines of text, separated by one or more blank lines. (A blank line is any line that looks like a blank line &#8211; a line containing nothing but spaces or tabs is considered blank.) Normal paragraphs should not be indented with spaces or tabs.</p>
144
-
145
- <p>The implication of the &#8220;one or more consecutive lines of text&#8221; rule is that Markdown supports &#8220;hard-wrapped&#8221; text paragraphs. This differs significantly from most other text-to-HTML formatters (including Movable Type&#8217;s &#8220;Convert Line Breaks&#8221; option) which translate every line break character in a paragraph into a <code>&lt;br /&gt;</code> tag.</p>
146
-
147
- <p>When you <em>do</em> want to insert a <code>&lt;br /&gt;</code> break tag using Markdown, you end a line with two or more spaces, then type return.</p>
148
-
149
- <p>Yes, this takes a tad more effort to create a <code>&lt;br /&gt;</code>, but a simplistic &#8220;every line break is a <code>&lt;br /&gt;</code>&#8221; rule wouldn&#8217;t work for Markdown. Markdown&#8217;s email-style <a href='#blockquote'>blockquoting</a> and multi-paragraph <a href='#list'>list items</a> work best &#8211; and look better &#8211; when you format them with hard breaks.</p>
150
- <h3 id='header'>Headers</h3>
151
- <p>Markdown supports two styles of headers, <a href='http://docutils.sourceforge.net/mirror/setext.html'>Setext</a> and <a href='http://www.aaronsw.com/2002/atx/'>atx</a>.</p>
152
-
153
- <p>Setext-style headers are &#8220;underlined&#8221; using equal signs (for first-level headers) and dashes (for second-level headers). For example:</p>
154
-
155
- <pre><code>This is an H1
156
- =============
157
-
158
- This is an H2
159
- -------------</code></pre>
160
-
161
- <p>Any number of underlining <code>=</code>&#8217;s or <code>-</code>&#8217;s will work.</p>
162
-
163
- <p>Atx-style headers use 1-6 hash characters at the start of the line, corresponding to header levels 1-6. For example:</p>
164
-
165
- <pre><code># This is an H1
166
-
167
- ## This is an H2
168
-
169
- ###### This is an H6</code></pre>
170
-
171
- <p>Optionally, you may &#8220;close&#8221; atx-style headers. This is purely cosmetic &#8211; you can use this if you think it looks better. The closing hashes don&#8217;t even need to match the number of hashes used to open the header. (The number of opening hashes determines the header level.) :</p>
172
-
173
- <pre><code># This is an H1 #
174
-
175
- ## This is an H2 ##
176
-
177
- ### This is an H3 ######</code></pre>
178
- <h3 id='blockquote'>Blockquotes</h3>
179
- <p>Markdown uses email-style <code>&gt;</code> characters for blockquoting. If you&#8217;re familiar with quoting passages of text in an email message, then you know how to create a blockquote in Markdown. It looks best if you hard wrap the text and put a <code>&gt;</code> before every line:</p>
180
-
181
- <pre><code>&gt; This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
182
- &gt; consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
183
- &gt; Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
184
- &gt;
185
- &gt; Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
186
- &gt; id sem consectetuer libero luctus adipiscing.</code></pre>
187
-
188
- <p>Markdown allows you to be lazy and only put the <code>&gt;</code> before the first line of a hard-wrapped paragraph:</p>
189
-
190
- <pre><code>&gt; This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
191
- consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
192
- Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
193
-
194
- &gt; Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
195
- id sem consectetuer libero luctus adipiscing.</code></pre>
196
-
197
- <p>Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by adding additional levels of <code>&gt;</code>:</p>
198
-
199
- <pre><code>&gt; This is the first level of quoting.
200
- &gt;
201
- &gt; &gt; This is nested blockquote.
202
- &gt;
203
- &gt; Back to the first level.</code></pre>
204
-
205
- <p>Blockquotes can contain other Markdown elements, including headers, lists, and code blocks:</p>
206
-
207
- <pre><code>&gt; ## This is a header.
208
- &gt;
209
- &gt; 1. This is the first list item.
210
- &gt; 2. This is the second list item.
211
- &gt;
212
- &gt; Here&#39;s some example code:
213
- &gt;
214
- &gt; return shell_exec(&quot;echo $input | $markdown_script&quot;);</code></pre>
215
-
216
- <p>Any decent text editor should make email-style quoting easy. For example, with BBEdit, you can make a selection and choose Increase Quote Level from the Text menu.</p>
217
- <h3 id='list'>Lists</h3>
218
- <p>Markdown supports ordered (numbered) and unordered (bulleted) lists.</p>
219
-
220
- <p>Unordered lists use asterisks, pluses, and hyphens &#8211; interchangably &#8211; as list markers:</p>
221
-
222
- <pre><code>* Red
223
- * Green
224
- * Blue</code></pre>
225
-
226
- <p>is equivalent to:</p>
227
-
228
- <pre><code>+ Red
229
- + Green
230
- + Blue</code></pre>
231
-
232
- <p>and:</p>
233
-
234
- <pre><code>- Red
235
- - Green
236
- - Blue</code></pre>
237
-
238
- <p>Ordered lists use numbers followed by periods:</p>
239
-
240
- <pre><code>1. Bird
241
- 2. McHale
242
- 3. Parish</code></pre>
243
-
244
- <p>It&#8217;s important to note that the actual numbers you use to mark the list have no effect on the HTML output Markdown produces. The HTML Markdown produces from the above list is:</p>
245
-
246
- <pre><code>&lt;ol&gt;
247
- &lt;li&gt;Bird&lt;/li&gt;
248
- &lt;li&gt;McHale&lt;/li&gt;
249
- &lt;li&gt;Parish&lt;/li&gt;
250
- &lt;/ol&gt;</code></pre>
251
-
252
- <p>If you instead wrote the list in Markdown like this:</p>
253
-
254
- <pre><code>1. Bird
255
- 1. McHale
256
- 1. Parish</code></pre>
257
-
258
- <p>or even:</p>
259
-
260
- <pre><code>3. Bird
261
- 1. McHale
262
- 8. Parish</code></pre>
263
-
264
- <p>you&#8217;d get the exact same HTML output. The point is, if you want to, you can use ordinal numbers in your ordered Markdown lists, so that the numbers in your source match the numbers in your published HTML. But if you want to be lazy, you don&#8217;t have to.</p>
265
-
266
- <p>If you do use lazy list numbering, however, you should still start the list with the number 1. At some point in the future, Markdown may support starting ordered lists at an arbitrary number.</p>
267
-
268
- <p>List markers typically start at the left margin, but may be indented by up to three spaces. List markers must be followed by one or more spaces or a tab.</p>
269
-
270
- <p>To make lists look nice, you can wrap items with hanging indents:</p>
271
-
272
- <pre><code>* Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
273
- Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
274
- viverra nec, fringilla in, laoreet vitae, risus.
275
- * Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
276
- Suspendisse id sem consectetuer libero luctus adipiscing.</code></pre>
277
-
278
- <p>But if you want to be lazy, you don&#8217;t have to:</p>
279
-
280
- <pre><code>* Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
281
- Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
282
- viverra nec, fringilla in, laoreet vitae, risus.
283
- * Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
284
- Suspendisse id sem consectetuer libero luctus adipiscing.</code></pre>
285
-
286
- <p>If list items are separated by blank lines, Markdown will wrap the items in <code>&lt;p&gt;</code> tags in the HTML output. For example, this input:</p>
287
-
288
- <pre><code>* Bird
289
- * Magic</code></pre>
290
-
291
- <p>will turn into:</p>
292
-
293
- <pre><code>&lt;ul&gt;
294
- &lt;li&gt;Bird&lt;/li&gt;
295
- &lt;li&gt;Magic&lt;/li&gt;
296
- &lt;/ul&gt;</code></pre>
297
-
298
- <p>But this:</p>
299
-
300
- <pre><code>* Bird
301
-
302
- * Magic</code></pre>
303
-
304
- <p>will turn into:</p>
305
-
306
- <pre><code>&lt;ul&gt;
307
- &lt;li&gt;&lt;p&gt;Bird&lt;/p&gt;&lt;/li&gt;
308
- &lt;li&gt;&lt;p&gt;Magic&lt;/p&gt;&lt;/li&gt;
309
- &lt;/ul&gt;</code></pre>
310
-
311
- <p>List items may consist of multiple paragraphs. Each subsequent paragraph in a list item must be intended by either 4 spaces or one tab:</p>
312
-
313
- <pre><code>1. This is a list item with two paragraphs. Lorem ipsum dolor
314
- sit amet, consectetuer adipiscing elit. Aliquam hendrerit
315
- mi posuere lectus.
316
-
317
- Vestibulum enim wisi, viverra nec, fringilla in, laoreet
318
- vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
319
- sit amet velit.
320
-
321
- 2. Suspendisse id sem consectetuer libero luctus adipiscing.</code></pre>
322
-
323
- <p>It looks nice if you indent every line of the subsequent paragraphs, but here again, Markdown will allow you to be lazy:</p>
324
-
325
- <pre><code>* This is a list item with two paragraphs.
326
-
327
- This is the second paragraph in the list item. You&#39;re
328
- only required to indent the first line. Lorem ipsum dolor
329
- sit amet, consectetuer adipiscing elit.
330
-
331
- * Another item in the same list.</code></pre>
332
-
333
- <p>To put a blockquote within a list item, the blockquote&#8217;s <code>&gt;</code> delimiters need to be indented:</p>
334
-
335
- <pre><code>* A list item with a blockquote:
336
-
337
- &gt; This is a blockquote
338
- &gt; inside a list item.</code></pre>
339
-
340
- <p>To put a code block within a list item, the code block needs to be indented <em>twice</em> &#8211; 8 spaces or two tabs:</p>
341
-
342
- <pre><code>* A list item with a code block:
343
-
344
- &lt;code goes here&gt;</code></pre>
345
-
346
- <p>It&#8217;s worth noting that it&#8217;s possible to trigger an ordered list by accident, by writing something like this:</p>
347
-
348
- <pre><code>1986. What a great season.</code></pre>
349
-
350
- <p>In other words, a <em>number-period-space</em> sequence at the beginning of a line. To avoid this, you can backslash-escape the period:</p>
351
-
352
- <pre><code>1986\. What a great season.</code></pre>
353
- <h3 id='precode'>Code Blocks</h3>
354
- <p>Pre-formatted code blocks are used for writing about programming or markup source code. Rather than forming normal paragraphs, the lines of a code block are interpreted literally. Markdown wraps a code block in both <code>&lt;pre&gt;</code> and <code>&lt;code&gt;</code> tags.</p>
355
-
356
- <p>To produce a code block in Markdown, simply indent every line of the block by at least 4 spaces or 1 tab. For example, given this input:</p>
357
-
358
- <pre><code>This is a normal paragraph:
359
-
360
- This is a code block.</code></pre>
361
-
362
- <p>Markdown will generate:</p>
363
-
364
- <pre><code>&lt;p&gt;This is a normal paragraph:&lt;/p&gt;
365
-
366
- &lt;pre&gt;&lt;code&gt;This is a code block.
367
- &lt;/code&gt;&lt;/pre&gt;</code></pre>
368
-
369
- <p>One level of indentation &#8211; 4 spaces or 1 tab &#8211; is removed from each line of the code block. For example, this:</p>
370
-
371
- <pre><code>Here is an example of AppleScript:
372
-
373
- tell application &quot;Foo&quot;
374
- beep
375
- end tell</code></pre>
376
-
377
- <p>will turn into:</p>
378
-
379
- <pre><code>&lt;p&gt;Here is an example of AppleScript:&lt;/p&gt;
380
-
381
- &lt;pre&gt;&lt;code&gt;tell application &quot;Foo&quot;
382
- beep
383
- end tell
384
- &lt;/code&gt;&lt;/pre&gt;</code></pre>
385
-
386
- <p>A code block continues until it reaches a line that is not indented (or the end of the article).</p>
387
-
388
- <p>Within a code block, ampersands (<code>&amp;</code>) and angle brackets (<code>&lt;</code> and <code>&gt;</code>) are automatically converted into HTML entities. This makes it very easy to include example HTML source code using Markdown &#8211; just paste it and indent it, and Markdown will handle the hassle of encoding the ampersands and angle brackets. For example, this:</p>
389
-
390
- <pre><code> &lt;div class=&quot;footer&quot;&gt;
391
- &amp;copy; 2004 Foo Corporation
392
- &lt;/div&gt;</code></pre>
393
-
394
- <p>will turn into:</p>
395
-
396
- <pre><code>&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;footer&quot;&amp;gt;
397
- &amp;amp;copy; 2004 Foo Corporation
398
- &amp;lt;/div&amp;gt;
399
- &lt;/code&gt;&lt;/pre&gt;</code></pre>
400
-
401
- <p>Regular Markdown syntax is not processed within code blocks. E.g., asterisks are just literal asterisks within a code block. This means it&#8217;s also easy to use Markdown to write about Markdown&#8217;s own syntax.</p>
402
- <h3 id='hr'>Horizontal Rules</h3>
403
- <p>You can produce a horizontal rule tag (<code>&lt;hr /&gt;</code>) by placing three or more hyphens, asterisks, or underscores on a line by themselves. If you wish, you may use spaces between the hyphens or asterisks. Each of the following lines will produce a horizontal rule:</p>
404
-
405
- <pre><code>* * *
406
-
407
- ***
408
-
409
- *****
410
-
411
- - - -
412
-
413
- ---------------------------------------</code></pre>
414
- <hr /><h2 id='span'>Span Elements</h2><h3 id='link'>Links</h3>
415
- <p>Markdown supports two style of links: <em>inline</em> and <em>reference</em>.</p>
416
-
417
- <p>In both styles, the link text is delimited by <span>square brackets</span>.</p>
418
-
419
- <p>To create an inline link, use a set of regular parentheses immediately after the link text&#8217;s closing square bracket. Inside the parentheses, put the URL where you want the link to point, along with an <em>optional</em> title for the link, surrounded in quotes. For example:</p>
420
-
421
- <pre><code>This is [an example](http://example.com/ &quot;Title&quot;) inline link.
422
-
423
- [This link](http://example.net/) has no title attribute.</code></pre>
424
-
425
- <p>Will produce:</p>
426
-
427
- <pre><code>&lt;p&gt;This is &lt;a href=&quot;http://example.com/&quot; title=&quot;Title&quot;&gt;
428
- an example&lt;/a&gt; inline link.&lt;/p&gt;
429
-
430
- &lt;p&gt;&lt;a href=&quot;http://example.net/&quot;&gt;This link&lt;/a&gt; has no
431
- title attribute.&lt;/p&gt;</code></pre>
432
-
433
- <p>If you&#8217;re referring to a local resource on the same server, you can use relative paths:</p>
434
-
435
- <pre><code>See my [About](/about/) page for details. </code></pre>
436
-
437
- <p>Reference-style links use a second set of square brackets, inside which you place a label of your choosing to identify the link:</p>
438
-
439
- <pre><code>This is [an example][id] reference-style link.</code></pre>
440
-
441
- <p>You can optionally use a space to separate the sets of brackets:</p>
442
-
443
- <pre><code>This is [an example] [id] reference-style link.</code></pre>
444
-
445
- <p>Then, anywhere in the document, you define your link label like this, on a line by itself:</p>
446
-
447
- <pre><code>[id]: http://example.com/ &quot;Optional Title Here&quot;</code></pre>
448
-
449
- <p>That is:</p>
450
-
451
- <ul>
452
- <li>Square brackets containing the link identifier (optionally indented from the left margin using up to three spaces);</li>
453
-
454
- <li>followed by a colon;</li>
455
-
456
- <li>followed by one or more spaces (or tabs);</li>
457
-
458
- <li>followed by the URL for the link;</li>
459
-
460
- <li>optionally followed by a title attribute for the link, enclosed in double or single quotes, or enclosed in parentheses.</li>
461
- </ul>
462
-
463
- <p>The following three link definitions are equivalent:</p>
464
-
465
- <pre><code>[foo]: http://example.com/ &quot;Optional Title Here&quot;
466
- [foo]: http://example.com/ &#39;Optional Title Here&#39;
467
- [foo]: http://example.com/ (Optional Title Here)</code></pre>
468
-
469
- <p><strong>Note:</strong> There is a known bug in Markdown.pl 1.0.1 which prevents single quotes from being used to delimit link titles.</p>
470
-
471
- <p>The link URL may, optionally, be surrounded by angle brackets:</p>
472
-
473
- <pre><code>[id]: &lt;http://example.com/&gt; &quot;Optional Title Here&quot;</code></pre>
474
-
475
- <p>You can put the title attribute on the next line and use extra spaces or tabs for padding, which tends to look better with longer URLs:</p>
476
-
477
- <pre><code>[id]: http://example.com/longish/path/to/resource/here
478
- &quot;Optional Title Here&quot;</code></pre>
479
-
480
- <p>Link definitions are only used for creating links during Markdown processing, and are stripped from your document in the HTML output.</p>
481
-
482
- <p>Link definition names may constist of letters, numbers, spaces, and punctuation &#8211; but they are <em>not</em> case sensitive. E.g. these two links:</p>
483
-
484
- <pre><code>[link text][a]
485
- [link text][A]</code></pre>
486
-
487
- <p>are equivalent.</p>
488
-
489
- <p>The <em>implicit link name</em> shortcut allows you to omit the name of the link, in which case the link text itself is used as the name. Just use an empty set of square brackets &#8211; e.g., to link the word &#8220;Google&#8221; to the google.com web site, you could simply write:</p>
490
-
491
- <pre><code>[Google][]</code></pre>
492
-
493
- <p>And then define the link:</p>
494
-
495
- <pre><code>[Google]: http://google.com/</code></pre>
496
-
497
- <p>Because link names may contain spaces, this shortcut even works for multiple words in the link text:</p>
498
-
499
- <pre><code>Visit [Daring Fireball][] for more information.</code></pre>
500
-
501
- <p>And then define the link:</p>
502
-
503
- <pre><code>[Daring Fireball]: http://daringfireball.net/</code></pre>
504
-
505
- <p>Link definitions can be placed anywhere in your Markdown document. I tend to put them immediately after each paragraph in which they&#8217;re used, but if you want, you can put them all at the end of your document, sort of like footnotes.</p>
506
-
507
- <p>Here&#8217;s an example of reference links in action:</p>
508
-
509
- <pre><code>I get 10 times more traffic from [Google] [1] than from
510
- [Yahoo] [2] or [MSN] [3].
511
-
512
- [1]: http://google.com/ &quot;Google&quot;
513
- [2]: http://search.yahoo.com/ &quot;Yahoo Search&quot;
514
- [3]: http://search.msn.com/ &quot;MSN Search&quot;</code></pre>
515
-
516
- <p>Using the implicit link name shortcut, you could instead write:</p>
517
-
518
- <pre><code>I get 10 times more traffic from [Google][] than from
519
- [Yahoo][] or [MSN][].
520
-
521
- [google]: http://google.com/ &quot;Google&quot;
522
- [yahoo]: http://search.yahoo.com/ &quot;Yahoo Search&quot;
523
- [msn]: http://search.msn.com/ &quot;MSN Search&quot;</code></pre>
524
-
525
- <p>Both of the above examples will produce the following HTML output:</p>
526
-
527
- <pre><code>&lt;p&gt;I get 10 times more traffic from &lt;a href=&quot;http://google.com/&quot;
528
- title=&quot;Google&quot;&gt;Google&lt;/a&gt; than from
529
- &lt;a href=&quot;http://search.yahoo.com/&quot; title=&quot;Yahoo Search&quot;&gt;Yahoo&lt;/a&gt;
530
- or &lt;a href=&quot;http://search.msn.com/&quot; title=&quot;MSN Search&quot;&gt;MSN&lt;/a&gt;.&lt;/p&gt;</code></pre>
531
-
532
- <p>For comparison, here is the same paragraph written using Markdown&#8217;s inline link style:</p>
533
-
534
- <pre><code>I get 10 times more traffic from [Google](http://google.com/ &quot;Google&quot;)
535
- than from [Yahoo](http://search.yahoo.com/ &quot;Yahoo Search&quot;) or
536
- [MSN](http://search.msn.com/ &quot;MSN Search&quot;).</code></pre>
537
-
538
- <p>The point of reference-style links is not that they&#8217;re easier to write. The point is that with reference-style links, your document source is vastly more readable. Compare the above examples: using reference-style links, the paragraph itself is only 81 characters long; with inline-style links, it&#8217;s 176 characters; and as raw HTML, it&#8217;s 234 characters. In the raw HTML, there&#8217;s more markup than there is text.</p>
539
-
540
- <p>With Markdown&#8217;s reference-style links, a source document much more closely resembles the final output, as rendered in a browser. By allowing you to move the markup-related metadata out of the paragraph, you can add links without interrupting the narrative flow of your prose.</p>
541
- <h3 id='em'>Emphasis</h3>
542
- <p>Markdown treats asterisks (<code>*</code>) and underscores (<code>_</code>) as indicators of emphasis. Text wrapped with one <code>*</code> or <code>_</code> will be wrapped with an HTML <code>&lt;em&gt;</code> tag; double <code>*</code>&#8217;s or <code>_</code>&#8217;s will be wrapped with an HTML <code>&lt;strong&gt;</code> tag. E.g., this input:</p>
543
-
544
- <pre><code>*single asterisks*
545
-
546
- _single underscores_
547
-
548
- **double asterisks**
549
-
550
- __double underscores__</code></pre>
551
-
552
- <p>will produce:</p>
553
-
554
- <pre><code>&lt;em&gt;single asterisks&lt;/em&gt;
555
-
556
- &lt;em&gt;single underscores&lt;/em&gt;
557
-
558
- &lt;strong&gt;double asterisks&lt;/strong&gt;
559
-
560
- &lt;strong&gt;double underscores&lt;/strong&gt;</code></pre>
561
-
562
- <p>You can use whichever style you prefer; the lone restriction is that the same character must be used to open and close an emphasis span.</p>
563
-
564
- <p>Emphasis can be used in the middle of a word:</p>
565
-
566
- <pre><code>un*fucking*believable</code></pre>
567
-
568
- <p>But if you surround an <code>*</code> or <code>_</code> with spaces, it&#8217;ll be treated as a literal asterisk or underscore.</p>
569
-
570
- <p>To produce a literal asterisk or underscore at a position where it would otherwise be used as an emphasis delimiter, you can backslash escape it:</p>
571
-
572
- <pre><code>\*this text is surrounded by literal asterisks\*</code></pre>
573
- <h3 id='code'>Code</h3>
574
- <p>To indicate a span of code, wrap it with backtick quotes (<code>`</code>). Unlike a pre-formatted code block, a code span indicates code within a normal paragraph. For example:</p>
575
-
576
- <pre><code>Use the `printf()` function.</code></pre>
577
-
578
- <p>will produce:</p>
579
-
580
- <pre><code>&lt;p&gt;Use the &lt;code&gt;printf()&lt;/code&gt; function.&lt;/p&gt;</code></pre>
581
-
582
- <p>To include a literal backtick character within a code span, you can use multiple backticks as the opening and closing delimiters:</p>
583
-
584
- <pre><code>``There is a literal backtick (`) here.``</code></pre>
585
-
586
- <p>which will produce this:</p>
587
-
588
- <pre><code>&lt;p&gt;&lt;code&gt;There is a literal backtick (`) here.&lt;/code&gt;&lt;/p&gt;</code></pre>
589
-
590
- <p>The backtick delimiters surrounding a code span may include spaces &#8211; one after the opening, one before the closing. This allows you to place literal backtick characters at the beginning or end of a code span:</p>
591
-
592
- <pre><code>A single backtick in a code span: `` ` ``
593
-
594
- A backtick-delimited string in a code span: `` `foo` ``</code></pre>
595
-
596
- <p>will produce:</p>
597
-
598
- <pre><code>&lt;p&gt;A single backtick in a code span: &lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
599
-
600
- &lt;p&gt;A backtick-delimited string in a code span: &lt;code&gt;`foo`&lt;/code&gt;&lt;/p&gt;</code></pre>
601
-
602
- <p>With a code span, ampersands and angle brackets are encoded as HTML entities automatically, which makes it easy to include example HTML tags. Markdown will turn this:</p>
603
-
604
- <pre><code>Please don&#39;t use any `&lt;blink&gt;` tags.</code></pre>
605
-
606
- <p>into:</p>
607
-
608
- <pre><code>&lt;p&gt;Please don&#39;t use any &lt;code&gt;&amp;lt;blink&amp;gt;&lt;/code&gt; tags.&lt;/p&gt;</code></pre>
609
-
610
- <p>You can write this:</p>
611
-
612
- <pre><code>`&amp;#8212;` is the decimal-encoded equivalent of `&amp;mdash;`.</code></pre>
613
-
614
- <p>to produce:</p>
615
-
616
- <pre><code>&lt;p&gt;&lt;code&gt;&amp;amp;#8212;&lt;/code&gt; is the decimal-encoded
617
- equivalent of &lt;code&gt;&amp;amp;mdash;&lt;/code&gt;.&lt;/p&gt;</code></pre>
618
- <h3 id='img'>Images</h3>
619
- <p>Admittedly, it&#8217;s fairly difficult to devise a &#8220;natural&#8221; syntax for placing images into a plain text document format.</p>
620
-
621
- <p>Markdown uses an image syntax that is intended to resemble the syntax for links, allowing for two styles: <em>inline</em> and <em>reference</em>.</p>
622
-
623
- <p>Inline image syntax looks like this:</p>
624
-
625
- <pre><code>![Alt text](/path/to/img.jpg)
626
-
627
- ![Alt text](/path/to/img.jpg &quot;Optional title&quot;)</code></pre>
628
-
629
- <p>That is:</p>
630
-
631
- <ul>
632
- <li>An exclamation mark: <code>!</code>;</li>
633
-
634
- <li>followed by a set of square brackets, containing the <code>alt</code> attribute text for the image;</li>
635
-
636
- <li>followed by a set of parentheses, containing the URL or path to the image, and an optional <code>title</code> attribute enclosed in double or single quotes.</li>
637
- </ul>
638
-
639
- <p>Reference-style image syntax looks like this:</p>
640
-
641
- <pre><code>![Alt text][id]</code></pre>
642
-
643
- <p>Where &#8220;id&#8221; is the name of a defined image reference. Image references are defined using syntax identical to link references:</p>
644
-
645
- <pre><code>[id]: url/to/image &quot;Optional title attribute&quot;</code></pre>
646
-
647
- <p>As of this writing, Markdown has no syntax for specifying the dimensions of an image; if this is important to you, you can simply use regular HTML <code>&lt;img&gt;</code> tags.</p>
648
- <hr /><h2 id='misc'>Miscellaneous</h2><h3 id='autolink'>Automatic Links</h3>
649
- <p>Markdown supports a shortcut style for creating &#8220;automatic&#8221; links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:</p>
650
-
651
- <pre><code>&lt;http://example.com/&gt;</code></pre>
652
-
653
- <p>Markdown will turn this into:</p>
654
-
655
- <pre><code>&lt;a href=&quot;http://example.com/&quot;&gt;http://example.com/&lt;/a&gt;</code></pre>
656
-
657
- <p>Automatic links for email addresses work similarly, except that Markdown will also perform a bit of randomized decimal and hex entity-encoding to help obscure your address from address-harvesting spambots. For example, Markdown will turn this:</p>
658
-
659
- <pre><code>&lt;address@example.com&gt;</code></pre>
660
-
661
- <p>into something like this:</p>
662
-
663
- <pre><code>&lt;a href=&quot;&amp;#x6D;&amp;#x61;i&amp;#x6C;&amp;#x74;&amp;#x6F;:&amp;#x61;&amp;#x64;&amp;#x64;&amp;#x72;&amp;#x65;
664
- &amp;#115;&amp;#115;&amp;#64;&amp;#101;&amp;#120;&amp;#x61;&amp;#109;&amp;#x70;&amp;#x6C;e&amp;#x2E;&amp;#99;&amp;#111;
665
- &amp;#109;&quot;&gt;&amp;#x61;&amp;#x64;&amp;#x64;&amp;#x72;&amp;#x65;&amp;#115;&amp;#115;&amp;#64;&amp;#101;&amp;#120;&amp;#x61;
666
- &amp;#109;&amp;#x70;&amp;#x6C;e&amp;#x2E;&amp;#99;&amp;#111;&amp;#109;&lt;/a&gt;</code></pre>
667
-
668
- <p>which will render in a browser as a clickable link to &#8220;address@example.com&#8221;.</p>
669
-
670
- <p>(This sort of entity-encoding trick will indeed fool many, if not most, address-harvesting bots, but it definitely won&#8217;t fool all of them. It&#8217;s better than nothing, but an address published in this way will probably eventually start receiving spam.)</p>
671
- <h3 id='backslash'>Backslash Escapes</h3>
672
- <p>Markdown allows you to use backslash escapes to generate literal characters which would otherwise have special meaning in Markdown&#8217;s formatting syntax. For example, if you wanted to surround a word with literal asterisks (instead of an HTML <code>&lt;em&gt;</code> tag), you can backslashes before the asterisks, like this:</p>
673
-
674
- <pre><code>\*literal asterisks\*</code></pre>
675
-
676
- <p>Markdown provides backslash escapes for the following characters:</p>
677
-
678
- <pre><code>\ backslash
679
- ` backtick
680
- * asterisk
681
- _ underscore
682
- {} curly braces
683
- [] square brackets
684
- () parentheses
685
- # hash mark
686
- + plus sign
687
- - minus sign (hyphen)
688
- . dot
689
- ! exclamation mark</code></pre>
690
- <div class='maruku_signature'><hr /><span style='font-size: small; font-style: italic'>Created by <a href='http://maruku.rubyforge.org' title='Maruku: a Markdown-superset interpreter for Ruby'>Maruku</a> at 13:32 on Sunday, February 18th, 2007.</span></div></body></html>