maruku 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. data/bin/{maruku0.3 → marudown} +6 -14
  2. data/bin/maruku +1 -1
  3. data/bin/marutest +37 -9
  4. data/docs/TOFIX.html +22 -0
  5. data/docs/TOFIX.md +3 -0
  6. data/docs/changelog-0.2.13.html +30 -0
  7. data/docs/changelog-0.2.13.md +6 -0
  8. data/docs/changelog-0.3.html +19 -5
  9. data/docs/faq.html +51 -40
  10. data/docs/faq.md +3 -3
  11. data/docs/hidden_o_n_squared.md +10 -0
  12. data/docs/index.html +84 -396
  13. data/docs/markdown_syntax.html +139 -330
  14. data/docs/markdown_syntax.md +80 -93
  15. data/docs/maruku.html +84 -396
  16. data/docs/maruku.md +88 -158
  17. data/docs/proposal.html +13 -106
  18. data/docs/proposal.md +3 -3
  19. data/docs/todo.html +38 -28
  20. data/lib/maruku.rb +77 -11
  21. data/lib/maruku/attributes.rb +186 -0
  22. data/lib/maruku/defaults.rb +40 -0
  23. data/lib/maruku/errors_management.rb +55 -39
  24. data/lib/maruku/helpers.rb +156 -72
  25. data/lib/maruku/input/charsource.rb +319 -0
  26. data/lib/maruku/{html_helper.rb → input/html_helper.rb} +30 -9
  27. data/lib/maruku/input/linesource.rb +111 -0
  28. data/lib/maruku/input/parse_block.rb +562 -0
  29. data/lib/maruku/{parse_doc.rb → input/parse_doc.rb} +60 -28
  30. data/lib/maruku/{parse_span_better.rb → input/parse_span_better.rb} +226 -256
  31. data/lib/maruku/input/type_detection.rb +137 -0
  32. data/lib/maruku/maruku.rb +33 -0
  33. data/lib/maruku/{to_html.rb → output/to_html.rb} +151 -132
  34. data/lib/maruku/{to_latex.rb → output/to_latex.rb} +31 -35
  35. data/lib/maruku/{to_latex_entities.rb → output/to_latex_entities.rb} +25 -3
  36. data/lib/maruku/output/to_latex_strings.rb +64 -0
  37. data/lib/maruku/output/to_markdown.rb +164 -0
  38. data/lib/maruku/{to_s.rb → output/to_s.rb} +6 -0
  39. data/lib/maruku/string_utils.rb +12 -181
  40. data/lib/maruku/structures.rb +91 -67
  41. data/lib/maruku/structures_inspect.rb +78 -0
  42. data/lib/maruku/structures_iterators.rb +24 -2
  43. data/lib/maruku/tests/benchmark.rb +41 -9
  44. data/lib/maruku/tests/new_parser.rb +317 -286
  45. data/lib/maruku/tests/tests.rb +20 -0
  46. data/lib/maruku/toc.rb +64 -64
  47. data/lib/maruku/usage/example1.rb +33 -0
  48. data/lib/maruku/version.rb +8 -2
  49. data/tests/unittest/abbreviations.md +27 -16
  50. data/tests/unittest/attributes/attributes.md +89 -0
  51. data/tests/unittest/attributes/circular.md +51 -0
  52. data/tests/unittest/attributes/default.md +47 -0
  53. data/tests/unittest/blank.md +10 -6
  54. data/tests/unittest/blanks_in_code.md +26 -26
  55. data/tests/unittest/code.md +9 -9
  56. data/tests/unittest/code2.md +12 -13
  57. data/tests/unittest/code3.md +34 -34
  58. data/tests/unittest/easy.md +9 -7
  59. data/tests/unittest/email.md +9 -7
  60. data/tests/unittest/encoding/iso-8859-1.md +41 -4
  61. data/tests/unittest/encoding/utf-8.md +6 -5
  62. data/tests/unittest/entities.md +52 -80
  63. data/tests/unittest/escaping.md +47 -35
  64. data/tests/unittest/extra_dl.md +19 -29
  65. data/tests/unittest/extra_header_id.md +31 -24
  66. data/tests/unittest/extra_table1.md +14 -32
  67. data/tests/unittest/footnotes.md +58 -42
  68. data/tests/unittest/headers.md +11 -11
  69. data/tests/unittest/hrule.md +14 -24
  70. data/tests/unittest/images.md +41 -26
  71. data/tests/unittest/inline_html.md +104 -56
  72. data/tests/unittest/inline_html2.md +38 -0
  73. data/tests/unittest/links.md +74 -33
  74. data/tests/unittest/list1.md +18 -15
  75. data/tests/unittest/list2.md +31 -13
  76. data/tests/unittest/list3.md +29 -28
  77. data/tests/unittest/list4.md +103 -12
  78. data/tests/unittest/lists.md +86 -53
  79. data/tests/unittest/lists6.md +53 -0
  80. data/tests/unittest/lists7.md +31 -0
  81. data/tests/unittest/lists_after_paragraph.md +105 -71
  82. data/tests/unittest/lists_ol.md +149 -73
  83. data/tests/unittest/misc_sw.md +366 -326
  84. data/tests/unittest/notyet/escape.md +10 -10
  85. data/tests/unittest/notyet/header_after_par.md +20 -14
  86. data/tests/unittest/notyet/ticks.md +8 -35
  87. data/tests/unittest/notyet/triggering.md +72 -45
  88. data/tests/unittest/olist.md +78 -0
  89. data/tests/unittest/one.md +5 -3
  90. data/tests/unittest/paragraph.md +5 -3
  91. data/tests/unittest/paragraph_rules/dont_merge_ref.md +15 -9
  92. data/tests/unittest/paragraph_rules/tab_is_blank.md +9 -5
  93. data/tests/unittest/paragraphs.md +21 -26
  94. data/tests/unittest/recover/recover_links.md +6 -5
  95. data/tests/unittest/references/long_example.md +39 -30
  96. data/tests/unittest/references/spaces_and_numbers.md +2 -2
  97. data/tests/unittest/syntax_hl.md +33 -31
  98. data/tests/unittest/test.md +4 -6
  99. data/tests/unittest/wrapping.md +43 -26
  100. metadata +160 -139
  101. data/docs/markdown_extra2.html +0 -87
  102. data/docs/markdown_extra2.md +0 -83
  103. data/docs/markdown_syntax_2.html +0 -152
  104. data/lib/maruku/parse_block.rb +0 -564
  105. data/lib/maruku/parse_span.rb +0 -451
  106. data/lib/maruku/to_latex_strings.rb +0 -59
  107. data/lib/maruku/to_markdown.rb +0 -110
  108. data/lib/test.rb +0 -29
@@ -1,95 +1,79 @@
1
1
  <?xml version='1.0' encoding='utf-8'?>
2
2
  <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
3
3
  'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
4
- <html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
5
- <head>
6
- <title>Markdown: Syntax</title>
7
-
8
- <link href='style.css' rel='stylesheet' type='text/css' />
9
- </head>
10
- <body>
4
+ <html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'><head><meta content='text/html; charset=utf-8' http-equiv='Content-type' /><title>Markdown: Syntax</title><link href='style.css' rel='stylesheet' type='text/css' /></head><body>
11
5
  <h1 id='markdown_syntax'>Markdown: Syntax</h1>
6
+ <ul id='ProjectSubmenu'>
7
+ <li><a href='/projects/markdown/' title='Markdown Project Page'>Main</a></li>
8
+ <li><a href='/projects/markdown/basics' title='Markdown Basics'>Basics</a></li>
9
+ <li><a class='selected' title='Markdown Syntax Documentation'>Syntax</a></li>
10
+ <li><a href='/projects/markdown/license' title='Pricing and License Information'>License</a></li>
11
+ <li><a href='/projects/markdown/dingus' title='Online Markdown Web Form'>Dingus</a></li>
12
+ </ul>
13
+ <ul>
14
+ <li>
15
+ <p><a href='#overview'>Overview</a></p>
12
16
 
13
- <p><strong>Note:</strong> </p>
17
+ <ul>
18
+ <li><a href='#philosophy'>Philosophy</a></li>
14
19
 
15
- <p>This copy is translated using <a href='http://maruku.rubyforge.org'>Maruku</a>.</p>
20
+ <li><a href='#html'>Inline HTML</a></li>
16
21
 
17
- <p><a href='http://daringfireball.net/projects/markdown/syntax'>Here</a> you can find the original by <code>Markdown.pl</code>.</p>
22
+ <li><a href='#autoescape'>Automatic Escaping for Special Characters</a></li>
23
+ </ul>
24
+ </li>
18
25
 
19
- <blockquote>
20
- <p><a href='http://maruku.rubyforge.org/markdown_syntax.md'>This document in Markdown</a></p>
26
+ <li>
27
+ <p><a href='#block'>Block Elements</a></p>
21
28
 
22
- <p><a href='http://maruku.rubyforge.org/markdown_syntax.html'>This document in HTML</a></p>
29
+ <ul>
30
+ <li><a href='#p'>Paragraphs and Line Breaks</a></li>
23
31
 
24
- <p><a href='http://maruku.rubyforge.org/markdown_syntax.pdf'>This document in PDF</a></p>
25
- </blockquote>
32
+ <li><a href='#header'>Headers</a></li>
26
33
 
27
- <p>Table of contents: (<strong>auto-generated by Maruku!</strong>)</p>
34
+ <li><a href='#blockquote'>Blockquotes</a></li>
28
35
 
29
- <div class='maruku_toc'>
30
- <ul style='list-style: none;'>
31
- <li><span class='maruku_section_number'>1. </span><a href='#overview'>Overview</a>
32
- <ul style='list-style: none;'>
33
- <li><span class='maruku_section_number'>1.1. </span><a href='#philosophy'>Philosophy</a></li>
36
+ <li><a href='#list'>Lists</a></li>
34
37
 
35
- <li><span class='maruku_section_number'>1.2. </span><a href='#html'>Inline HTML</a></li>
38
+ <li><a href='#precode'>Code Blocks</a></li>
36
39
 
37
- <li><span class='maruku_section_number'>1.3. </span><a href='#autoescape'>Automatic Escaping for Special Characters</a></li>
40
+ <li><a href='#hr'>Horizontal Rules</a></li>
38
41
  </ul>
39
42
  </li>
40
43
 
41
- <li><span class='maruku_section_number'>2. </span><a href='#block'>Block Elements</a>
42
- <ul style='list-style: none;'>
43
- <li><span class='maruku_section_number'>2.1. </span><a href='#p'>Paragraphs and Line Breaks</a></li>
44
-
45
- <li><span class='maruku_section_number'>2.2. </span><a href='#header'>Headers</a></li>
44
+ <li>
45
+ <p><a href='#span'>Span Elements</a></p>
46
46
 
47
- <li><span class='maruku_section_number'>2.3. </span><a href='#blockquote'>Blockquotes</a></li>
47
+ <ul>
48
+ <li><a href='#link'>Links</a></li>
48
49
 
49
- <li><span class='maruku_section_number'>2.4. </span><a href='#list'>Lists</a></li>
50
+ <li><a href='#em'>Emphasis</a></li>
50
51
 
51
- <li><span class='maruku_section_number'>2.5. </span><a href='#precode'>Code Blocks</a></li>
52
+ <li><a href='#code'>Code</a></li>
52
53
 
53
- <li><span class='maruku_section_number'>2.6. </span><a href='#hr'>Horizontal Rules</a></li>
54
+ <li><a href='#img'>Images</a></li>
54
55
  </ul>
55
56
  </li>
56
57
 
57
- <li><span class='maruku_section_number'>3. </span><a href='#span'>Span Elements</a>
58
- <ul style='list-style: none;'>
59
- <li><span class='maruku_section_number'>3.1. </span><a href='#link'>Links</a></li>
60
-
61
- <li><span class='maruku_section_number'>3.2. </span><a href='#em'>Emphasis</a></li>
58
+ <li>
59
+ <p><a href='#misc'>Miscellaneous</a></p>
62
60
 
63
- <li><span class='maruku_section_number'>3.3. </span><a href='#code'>Code</a></li>
64
-
65
- <li><span class='maruku_section_number'>3.4. </span><a href='#img'>Images</a></li>
66
- </ul>
67
- </li>
68
-
69
- <li><span class='maruku_section_number'>4. </span><a href='#misc'>Miscellaneous</a>
70
- <ul style='list-style: none;'>
71
- <li><span class='maruku_section_number'>4.1. </span><a href='#autolink'>Automatic Links</a></li>
61
+ <ul>
62
+ <li><a href='#backslash'>Backslash Escapes</a></li>
72
63
 
73
- <li><span class='maruku_section_number'>4.2. </span><a href='#backslash'>Backslash Escapes</a></li>
64
+ <li><a href='#autolink'>Automatic Links</a></li>
74
65
  </ul>
75
66
  </li>
76
67
  </ul>
77
- </div>
78
-
79
- <hr />
80
-
81
- <h2 id='overview'><span class='maruku_section_number'>1. </span>Overview</h2>
82
-
83
- <h3 id='philosophy'><span class='maruku_section_number'>1.1. </span>Philosophy</h3>
84
68
 
69
+ <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 &apos;.text&apos; to the URL</a>.</p>
70
+ <hr /><h2 id='overview'>Overview</h2><h3 id='philosophy'>Philosophy</h3>
85
71
  <p>Markdown is intended to be as easy-to-read and easy-to-write as is feasible.</p>
86
72
 
87
73
  <p>Readability, however, is emphasized above all else. A Markdown-formatted document should be publishable as-is, as plain text, without looking like it&apos;s been marked up with tags or formatting instructions. While Markdown&apos;s syntax has been influenced by several existing text-to-HTML filters -- 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> -- the single biggest source of inspiration for Markdown&apos;s syntax is the format of plain text email.</p>
88
74
 
89
75
  <p>To this end, Markdown&apos;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&apos;ve ever used email.</p>
90
-
91
- <h3 id='html'><span class='maruku_section_number'>1.2. </span>Inline HTML</h3>
92
-
76
+ <h3 id='html'>Inline HTML</h3>
93
77
  <p>Markdown&apos;s syntax is intended for one purpose: to be used as a format for <em>writing</em> for the web.</p>
94
78
 
95
79
  <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&apos;s formatting syntax only addresses issues that can be conveyed in plain text.</p>
@@ -99,117 +83,86 @@
99
83
  <p>The only restrictions are that block-level HTML elements -- e.g. <code>&lt;div&gt;</code>, <code>&lt;table&gt;</code>, <code>&lt;pre&gt;</code>, <code>&lt;p&gt;</code>, etc. -- 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>
100
84
 
101
85
  <p>For example, to add an HTML table to a Markdown article:</p>
86
+ <pre><code>This is a regular paragraph.
102
87
 
103
- <pre class='xml'>This is a regular paragraph.
104
-
105
- <span class='punct'>&lt;</span><span class='tag'>table</span><span class='punct'>&gt;</span>
106
- <span class='punct'>&lt;</span><span class='tag'>tr</span><span class='punct'>&gt;</span>
107
- <span class='punct'>&lt;</span><span class='tag'>td</span><span class='punct'>&gt;</span>Foo<span class='punct'>&lt;/</span><span class='tag'>td</span><span class='punct'>&gt;</span>
108
- <span class='punct'>&lt;/</span><span class='tag'>tr</span><span class='punct'>&gt;</span>
109
- <span class='punct'>&lt;/</span><span class='tag'>table</span><span class='punct'>&gt;</span>
110
-
111
- This is another regular paragraph.</pre>
88
+ &lt;table&gt;
89
+ &lt;tr&gt;
90
+ &lt;td&gt;Foo&lt;/td&gt;
91
+ &lt;/tr&gt;
92
+ &lt;/table&gt;
112
93
 
94
+ This is another regular paragraph.
95
+ </code></pre>
113
96
  <p>Note that Markdown formatting syntax is not processed within block-level HTML tags. E.g., you can&apos;t use Markdown-style <code>*emphasis*</code> inside an HTML block.</p>
114
97
 
115
98
  <p>Span-level HTML tags -- e.g. <code>&lt;span&gt;</code>, <code>&lt;cite&gt;</code>, or <code>&lt;del&gt;</code> -- 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&apos;d prefer to use HTML <code>&lt;a&gt;</code> or <code>&lt;img&gt;</code> tags instead of Markdown&apos;s link or image syntax, go right ahead.</p>
116
99
 
117
100
  <p>Unlike block-level HTML tags, Markdown syntax <em>is</em> processed within span-level tags.</p>
118
-
119
- <h3 id='autoescape'><span class='maruku_section_number'>1.3. </span>Automatic Escaping for Special Characters</h3>
120
-
101
+ <h3 id='autoescape'>Automatic Escaping for Special Characters</h3>
121
102
  <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>
122
103
 
123
104
  <p>Ampersands in particular are bedeviling for web writers. If you want to write about &apos;AT&amp;T&apos;, you need to write &apos;<code>AT&amp;amp;T</code>&apos;. You even need to escape ampersands within URLs. Thus, if you want to link to:</p>
124
-
125
105
  <pre><code>http://images.google.com/images?num=30&amp;q=larry+bird
126
106
  </code></pre>
127
-
128
107
  <p>you need to encode the URL as:</p>
129
-
130
108
  <pre><code>http://images.google.com/images?num=30&amp;amp;q=larry+bird
131
109
  </code></pre>
132
-
133
110
  <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>
134
111
 
135
112
  <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>
136
113
 
137
114
  <p>So, if you want to include a copyright symbol in your article, you can write:</p>
138
-
139
- <pre class='xml'><span class='entity'>&amp;copy;</span></pre>
140
-
115
+ <pre><code>&amp;copy;
116
+ </code></pre>
141
117
  <p>and Markdown will leave it alone. But if you write:</p>
142
-
143
118
  <pre><code>AT&amp;T
144
119
  </code></pre>
145
-
146
120
  <p>Markdown will translate it to:</p>
147
-
148
- <pre class='xml'>AT<span class='entity'>&amp;amp;T</span></pre>
149
-
121
+ <pre><code>AT&amp;amp;T
122
+ </code></pre>
150
123
  <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>
151
-
152
124
  <pre><code>4 &lt; 5
153
125
  </code></pre>
154
-
155
126
  <p>Markdown will translate it to:</p>
156
-
157
- <pre class='xml'>4 <span class='entity'>&amp;lt;</span> 5</pre>
158
-
127
+ <pre><code>4 &amp;lt; 5
128
+ </code></pre>
159
129
  <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>
160
-
161
- <hr />
162
-
163
- <h2 id='block'><span class='maruku_section_number'>2. </span>Block Elements</h2>
164
-
165
- <h3 id='p'><span class='maruku_section_number'>2.1. </span>Paragraphs and Line Breaks</h3>
166
-
167
- <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 -- a line containing nothing but spaces or tabs is considered blank.) Normal paragraphs should not be intended with spaces or tabs.</p>
130
+ <hr /><h2 id='block'>Block Elements</h2><h3 id='p'>Paragraphs and Line Breaks</h3>
131
+ <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 -- a line containing nothing but spaces or tabs is considered blank.) Normal paragraphs should not be indented with spaces or tabs.</p>
168
132
 
169
133
  <p>The implication of the &quot;one or more consecutive lines of text&quot; rule is that Markdown supports &quot;hard-wrapped&quot; text paragraphs. This differs significantly from most other text-to-HTML formatters (including Movable Type&apos;s &quot;Convert Line Breaks&quot; option) which translate every line break character in a paragraph into a <code>&lt;br /&gt;</code> tag.</p>
170
134
 
171
135
  <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>
172
136
 
173
137
  <p>Yes, this takes a tad more effort to create a <code>&lt;br /&gt;</code>, but a simplistic &quot;every line break is a <code>&lt;br /&gt;</code>&quot; rule wouldn&apos;t work for Markdown. Markdown&apos;s email-style <a href='#blockquote'>blockquoting</a> and multi-paragraph <a href='#list'>list items</a> work best -- and look better -- when you format them with hard breaks.</p>
174
-
175
- <h3 id='header'><span class='maruku_section_number'>2.2. </span>Headers</h3>
176
-
138
+ <h3 id='header'>Headers</h3>
177
139
  <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>
178
140
 
179
141
  <p>Setext-style headers are &quot;underlined&quot; using equal signs (for first-level headers) and dashes (for second-level headers). For example:</p>
180
-
181
142
  <pre><code>This is an H1
182
143
  =============
183
144
 
184
145
  This is an H2
185
146
  -------------
186
147
  </code></pre>
187
-
188
148
  <p>Any number of underlining <code>=</code>&apos;s or <code>-</code>&apos;s will work.</p>
189
149
 
190
150
  <p>Atx-style headers use 1-6 hash characters at the start of the line, corresponding to header levels 1-6. For example:</p>
191
-
192
151
  <pre><code># This is an H1
193
152
 
194
153
  ## This is an H2
195
154
 
196
155
  ###### This is an H6
197
156
  </code></pre>
198
-
199
157
  <p>Optionally, you may &quot;close&quot; atx-style headers. This is purely cosmetic -- you can use this if you think it looks better. The closing hashes don&apos;t even need to match the number of hashes used to open the header. (The number of opening hashes determines the header level.) :</p>
200
-
201
158
  <pre><code># This is an H1 #
202
159
 
203
160
  ## This is an H2 ##
204
161
 
205
162
  ### This is an H3 ######
206
163
 
207
- </code></pre>
208
-
209
- <h3 id='blockquote'><span class='maruku_section_number'>2.3. </span>Blockquotes</h3>
210
-
164
+ </code></pre><h3 id='blockquote'>Blockquotes</h3>
211
165
  <p>Markdown uses email-style <code>&gt;</code> characters for blockquoting. If you&apos;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>
212
-
213
166
  <pre><code>&gt; This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
214
167
  &gt; consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
215
168
  &gt; Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
@@ -217,9 +170,7 @@ This is an H2
217
170
  &gt; Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
218
171
  &gt; id sem consectetuer libero luctus adipiscing.
219
172
  </code></pre>
220
-
221
173
  <p>Markdown allows you to be lazy and only put the <code>&gt;</code> before the first line of a hard-wrapped paragraph:</p>
222
-
223
174
  <pre><code>&gt; This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
224
175
  consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
225
176
  Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
@@ -227,18 +178,14 @@ Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
227
178
  &gt; Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
228
179
  id sem consectetuer libero luctus adipiscing.
229
180
  </code></pre>
230
-
231
181
  <p>Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by adding additional levels of <code>&gt;</code>:</p>
232
-
233
182
  <pre><code>&gt; This is the first level of quoting.
234
183
  &gt;
235
184
  &gt; &gt; This is nested blockquote.
236
185
  &gt;
237
186
  &gt; Back to the first level.
238
187
  </code></pre>
239
-
240
188
  <p>Blockquotes can contain other Markdown elements, including headers, lists, and code blocks:</p>
241
-
242
189
  <pre><code>&gt; ## This is a header.
243
190
  &gt;
244
191
  &gt; 1. This is the first list item.
@@ -248,63 +195,47 @@ id sem consectetuer libero luctus adipiscing.
248
195
  &gt;
249
196
  &gt; return shell_exec(&quot;echo $input | $markdown_script&quot;);
250
197
  </code></pre>
251
-
252
198
  <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>
253
-
254
- <h3 id='list'><span class='maruku_section_number'>2.4. </span>Lists</h3>
255
-
199
+ <h3 id='list'>Lists</h3>
256
200
  <p>Markdown supports ordered (numbered) and unordered (bulleted) lists.</p>
257
201
 
258
202
  <p>Unordered lists use asterisks, pluses, and hyphens -- interchangably -- as list markers:</p>
259
-
260
203
  <pre><code>* Red
261
204
  * Green
262
205
  * Blue
263
206
  </code></pre>
264
-
265
207
  <p>is equivalent to:</p>
266
-
267
208
  <pre><code>+ Red
268
209
  + Green
269
210
  + Blue
270
211
  </code></pre>
271
-
272
212
  <p>and:</p>
273
-
274
213
  <pre><code>- Red
275
214
  - Green
276
215
  - Blue
277
216
  </code></pre>
278
-
279
217
  <p>Ordered lists use numbers followed by periods:</p>
280
-
281
218
  <pre><code>1. Bird
282
219
  2. McHale
283
220
  3. Parish
284
221
  </code></pre>
285
-
286
222
  <p>It&apos;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>
287
-
288
- <pre class='xml'><span class='punct'>&lt;</span><span class='tag'>ol</span><span class='punct'>&gt;</span>
289
- <span class='punct'>&lt;</span><span class='tag'>li</span><span class='punct'>&gt;</span>Bird<span class='punct'>&lt;/</span><span class='tag'>li</span><span class='punct'>&gt;</span>
290
- <span class='punct'>&lt;</span><span class='tag'>li</span><span class='punct'>&gt;</span>McHale<span class='punct'>&lt;/</span><span class='tag'>li</span><span class='punct'>&gt;</span>
291
- <span class='punct'>&lt;</span><span class='tag'>li</span><span class='punct'>&gt;</span>Parish<span class='punct'>&lt;/</span><span class='tag'>li</span><span class='punct'>&gt;</span>
292
- <span class='punct'>&lt;/</span><span class='tag'>ol</span><span class='punct'>&gt;</span></pre>
293
-
223
+ <pre><code>&lt;ol&gt;
224
+ &lt;li&gt;Bird&lt;/li&gt;
225
+ &lt;li&gt;McHale&lt;/li&gt;
226
+ &lt;li&gt;Parish&lt;/li&gt;
227
+ &lt;/ol&gt;
228
+ </code></pre>
294
229
  <p>If you instead wrote the list in Markdown like this:</p>
295
-
296
230
  <pre><code>1. Bird
297
231
  1. McHale
298
232
  1. Parish
299
233
  </code></pre>
300
-
301
234
  <p>or even:</p>
302
-
303
235
  <pre><code>3. Bird
304
236
  1. McHale
305
237
  8. Parish
306
238
  </code></pre>
307
-
308
239
  <p>you&apos;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&apos;t have to.</p>
309
240
 
310
241
  <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>
@@ -312,52 +243,41 @@ id sem consectetuer libero luctus adipiscing.
312
243
  <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>
313
244
 
314
245
  <p>To make lists look nice, you can wrap items with hanging indents:</p>
315
-
316
246
  <pre><code>* Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
317
247
  Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
318
248
  viverra nec, fringilla in, laoreet vitae, risus.
319
249
  * Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
320
250
  Suspendisse id sem consectetuer libero luctus adipiscing.
321
251
  </code></pre>
322
-
323
252
  <p>But if you want to be lazy, you don&apos;t have to:</p>
324
-
325
253
  <pre><code>* Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
326
254
  Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
327
255
  viverra nec, fringilla in, laoreet vitae, risus.
328
256
  * Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
329
257
  Suspendisse id sem consectetuer libero luctus adipiscing.
330
258
  </code></pre>
331
-
332
259
  <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>
333
-
334
260
  <pre><code>* Bird
335
261
  * Magic
336
262
  </code></pre>
337
-
338
263
  <p>will turn into:</p>
339
-
340
- <pre class='xml'><span class='punct'>&lt;</span><span class='tag'>ul</span><span class='punct'>&gt;</span>
341
- <span class='punct'>&lt;</span><span class='tag'>li</span><span class='punct'>&gt;</span>Bird<span class='punct'>&lt;/</span><span class='tag'>li</span><span class='punct'>&gt;</span>
342
- <span class='punct'>&lt;</span><span class='tag'>li</span><span class='punct'>&gt;</span>Magic<span class='punct'>&lt;/</span><span class='tag'>li</span><span class='punct'>&gt;</span>
343
- <span class='punct'>&lt;/</span><span class='tag'>ul</span><span class='punct'>&gt;</span></pre>
344
-
264
+ <pre><code>&lt;ul&gt;
265
+ &lt;li&gt;Bird&lt;/li&gt;
266
+ &lt;li&gt;Magic&lt;/li&gt;
267
+ &lt;/ul&gt;
268
+ </code></pre>
345
269
  <p>But this:</p>
346
-
347
270
  <pre><code>* Bird
348
271
 
349
272
  * Magic
350
273
  </code></pre>
351
-
352
274
  <p>will turn into:</p>
353
-
354
- <pre class='xml'><span class='punct'>&lt;</span><span class='tag'>ul</span><span class='punct'>&gt;</span>
355
- <span class='punct'>&lt;</span><span class='tag'>li</span><span class='punct'>&gt;&lt;</span><span class='tag'>p</span><span class='punct'>&gt;</span>Bird<span class='punct'>&lt;/</span><span class='tag'>p</span><span class='punct'>&gt;&lt;/</span><span class='tag'>li</span><span class='punct'>&gt;</span>
356
- <span class='punct'>&lt;</span><span class='tag'>li</span><span class='punct'>&gt;&lt;</span><span class='tag'>p</span><span class='punct'>&gt;</span>Magic<span class='punct'>&lt;/</span><span class='tag'>p</span><span class='punct'>&gt;&lt;/</span><span class='tag'>li</span><span class='punct'>&gt;</span>
357
- <span class='punct'>&lt;/</span><span class='tag'>ul</span><span class='punct'>&gt;</span></pre>
358
-
275
+ <pre><code>&lt;ul&gt;
276
+ &lt;li&gt;&lt;p&gt;Bird&lt;/p&gt;&lt;/li&gt;
277
+ &lt;li&gt;&lt;p&gt;Magic&lt;/p&gt;&lt;/li&gt;
278
+ &lt;/ul&gt;
279
+ </code></pre>
359
280
  <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>
360
-
361
281
  <pre><code>1. This is a list item with two paragraphs. Lorem ipsum dolor
362
282
  sit amet, consectetuer adipiscing elit. Aliquam hendrerit
363
283
  mi posuere lectus.
@@ -368,9 +288,7 @@ Suspendisse id sem consectetuer libero luctus adipiscing.
368
288
 
369
289
  2. Suspendisse id sem consectetuer libero luctus adipiscing.
370
290
  </code></pre>
371
-
372
291
  <p>It looks nice if you indent every line of the subsequent paragraphs, but here again, Markdown will allow you to be lazy:</p>
373
-
374
292
  <pre><code>* This is a list item with two paragraphs.
375
293
 
376
294
  This is the second paragraph in the list item. You&apos;re
@@ -379,93 +297,70 @@ sit amet, consectetuer adipiscing elit.
379
297
 
380
298
  * Another item in the same list.
381
299
  </code></pre>
382
-
383
300
  <p>To put a blockquote within a list item, the blockquote&apos;s <code>&gt;</code> delimiters need to be indented:</p>
384
-
385
301
  <pre><code>* A list item with a blockquote:
386
302
 
387
303
  &gt; This is a blockquote
388
304
  &gt; inside a list item.
389
305
  </code></pre>
390
-
391
306
  <p>To put a code block within a list item, the code block needs to be indented <em>twice</em> -- 8 spaces or two tabs:</p>
392
-
393
307
  <pre><code>* A list item with a code block:
394
308
 
395
309
  &lt;code goes here&gt;
396
310
 
397
311
  </code></pre>
398
-
399
312
  <p>It&apos;s worth noting that it&apos;s possible to trigger an ordered list by accident, by writing something like this:</p>
400
-
401
313
  <pre><code>1986. What a great season.
402
314
  </code></pre>
403
-
404
315
  <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>
316
+ <pre><code>1986\. What a great season.
405
317
 
406
- <pre><code>1986\\. What a great season.
407
-
408
-
409
- </code></pre>
410
-
411
- <h3 id='precode'><span class='maruku_section_number'>2.5. </span>Code Blocks</h3>
412
318
 
319
+ </code></pre><h3 id='precode'>Code Blocks</h3>
413
320
  <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>
414
321
 
415
322
  <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>
416
-
417
323
  <pre><code>This is a normal paragraph:
418
324
 
419
325
  This is a code block.
420
326
  </code></pre>
421
-
422
327
  <p>Markdown will generate:</p>
328
+ <pre><code>&lt;p&gt;This is a normal paragraph:&lt;/p&gt;
423
329
 
424
- <pre class='xml'><span class='punct'>&lt;</span><span class='tag'>p</span><span class='punct'>&gt;</span>This is a normal paragraph:<span class='punct'>&lt;/</span><span class='tag'>p</span><span class='punct'>&gt;</span>
425
-
426
- <span class='punct'>&lt;</span><span class='tag'>pre</span><span class='punct'>&gt;&lt;</span><span class='tag'>code</span><span class='punct'>&gt;</span>This is a code block.
427
- <span class='punct'>&lt;/</span><span class='tag'>code</span><span class='punct'>&gt;&lt;/</span><span class='tag'>pre</span><span class='punct'>&gt;</span></pre>
428
-
330
+ &lt;pre&gt;&lt;code&gt;This is a code block.
331
+ &lt;/code&gt;&lt;/pre&gt;
332
+ </code></pre>
429
333
  <p>One level of indentation -- 4 spaces or 1 tab -- is removed from each line of the code block. For example, this:</p>
430
-
431
334
  <pre><code>Here is an example of AppleScript:
432
335
 
433
336
  tell application &quot;Foo&quot;
434
337
  beep
435
338
  end tell
436
339
  </code></pre>
437
-
438
340
  <p>will turn into:</p>
341
+ <pre><code>&lt;p&gt;Here is an example of AppleScript:&lt;/p&gt;
439
342
 
440
- <pre class='xml'><span class='punct'>&lt;</span><span class='tag'>p</span><span class='punct'>&gt;</span>Here is an example of AppleScript:<span class='punct'>&lt;/</span><span class='tag'>p</span><span class='punct'>&gt;</span>
441
-
442
- <span class='punct'>&lt;</span><span class='tag'>pre</span><span class='punct'>&gt;&lt;</span><span class='tag'>code</span><span class='punct'>&gt;</span>tell application &quot;Foo&quot;
343
+ &lt;pre&gt;&lt;code&gt;tell application &quot;Foo&quot;
443
344
  beep
444
345
  end tell
445
- <span class='punct'>&lt;/</span><span class='tag'>code</span><span class='punct'>&gt;&lt;/</span><span class='tag'>pre</span><span class='punct'>&gt;</span></pre>
446
-
346
+ &lt;/code&gt;&lt;/pre&gt;
347
+ </code></pre>
447
348
  <p>A code block continues until it reaches a line that is not indented (or the end of the article).</p>
448
349
 
449
350
  <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 -- just paste it and indent it, and Markdown will handle the hassle of encoding the ampersands and angle brackets. For example, this:</p>
450
-
451
351
  <pre><code> &lt;div class=&quot;footer&quot;&gt;
452
352
  &amp;copy; 2004 Foo Corporation
453
353
  &lt;/div&gt;
454
354
  </code></pre>
455
-
456
355
  <p>will turn into:</p>
457
-
458
- <pre class='xml'><span class='punct'>&lt;</span><span class='tag'>pre</span><span class='punct'>&gt;&lt;</span><span class='tag'>code</span><span class='punct'>&gt;</span><span class='entity'>&amp;lt;</span>div class=&quot;footer&quot;<span class='entity'>&amp;gt;</span>
459
- <span class='entity'>&amp;amp;copy;</span> 2004 Foo Corporation
460
- <span class='entity'>&amp;lt;/div&amp;gt;</span>
461
- <span class='punct'>&lt;/</span><span class='tag'>code</span><span class='punct'>&gt;&lt;/</span><span class='tag'>pre</span><span class='punct'>&gt;</span></pre>
462
-
356
+ <pre><code>&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;footer&quot;&amp;gt;
357
+ &amp;amp;copy; 2004 Foo Corporation
358
+ &amp;lt;/div&amp;gt;
359
+ &lt;/code&gt;&lt;/pre&gt;
360
+ </code></pre>
463
361
  <p>Regular Markdown syntax is not processed within code blocks. E.g., asterisks are just literal asterisks within a code block. This means it&apos;s also easy to use Markdown to write about Markdown&apos;s own syntax.</p>
464
-
465
- <h3 id='hr'><span class='maruku_section_number'>2.6. </span>Horizontal Rules</h3>
466
-
467
- <p>You can produce a horizontal rule tag (<code>&lt;hr /&gt;</code>) by placing three or more hyphens or asterisks 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>
468
-
362
+ <h3 id='hr'>Horizontal Rules</h3>
363
+ <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>
469
364
  <pre><code>* * *
470
365
 
471
366
  ***
@@ -476,57 +371,39 @@ end tell
476
371
 
477
372
  ---------------------------------------
478
373
 
479
- </code></pre>
480
-
481
- <hr />
482
-
483
- <h2 id='span'><span class='maruku_section_number'>3. </span>Span Elements</h2>
484
-
485
- <h3 id='link'><span class='maruku_section_number'>3.1. </span>Links</h3>
486
-
374
+ </code></pre><hr /><h2 id='span'>Span Elements</h2><h3 id='link'>Links</h3>
487
375
  <p>Markdown supports two style of links: <em>inline</em> and <em>reference</em>.</p>
488
376
 
489
377
  <p>In both styles, the link text is delimited by square brackets.</p>
490
378
 
491
379
  <p>To create an inline link, use a set of regular parentheses immediately after the link text&apos;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>
492
-
493
380
  <pre><code>This is [an example](http://example.com/ &quot;Title&quot;) inline link.
494
381
 
495
382
  [This link](http://example.net/) has no title attribute.
496
383
  </code></pre>
497
-
498
384
  <p>Will produce:</p>
385
+ <pre><code>&lt;p&gt;This is &lt;a href=&quot;http://example.com/&quot; title=&quot;Title&quot;&gt;
386
+ an example&lt;/a&gt; inline link.&lt;/p&gt;
499
387
 
500
- <pre class='xml'><span class='punct'>&lt;</span><span class='tag'>p</span><span class='punct'>&gt;</span>This is <span class='punct'>&lt;</span><span class='tag'>a</span> <span class='attribute'>href</span><span class='punct'>=&quot;</span><span class='string'>http://example.com/</span><span class='punct'>&quot;</span> <span class='attribute'>title</span><span class='punct'>=&quot;</span><span class='string'>Title</span><span class='punct'>&quot;&gt;</span>
501
- an example<span class='punct'>&lt;/</span><span class='tag'>a</span><span class='punct'>&gt;</span> inline link.<span class='punct'>&lt;/</span><span class='tag'>p</span><span class='punct'>&gt;</span>
502
-
503
- <span class='punct'>&lt;</span><span class='tag'>p</span><span class='punct'>&gt;&lt;</span><span class='tag'>a</span> <span class='attribute'>href</span><span class='punct'>=&quot;</span><span class='string'>http://example.net/</span><span class='punct'>&quot;&gt;</span>This link<span class='punct'>&lt;/</span><span class='tag'>a</span><span class='punct'>&gt;</span> has no
504
- title attribute.<span class='punct'>&lt;/</span><span class='tag'>p</span><span class='punct'>&gt;</span></pre>
505
-
388
+ &lt;p&gt;&lt;a href=&quot;http://example.net/&quot;&gt;This link&lt;/a&gt; has no
389
+ title attribute.&lt;/p&gt;
390
+ </code></pre>
506
391
  <p>If you&apos;re referring to a local resource on the same server, you can use relative paths:</p>
507
-
508
392
  <pre><code>See my [About](/about/) page for details.
509
393
  </code></pre>
510
-
511
394
  <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>
512
-
513
395
  <pre><code>This is [an example][id] reference-style link.
514
396
  </code></pre>
515
-
516
397
  <p>You can optionally use a space to separate the sets of brackets:</p>
517
-
518
398
  <pre><code>This is [an example] [id] reference-style link.
519
399
  </code></pre>
520
-
521
400
  <p>Then, anywhere in the document, you define your link label like this, on a line by itself:</p>
522
-
523
401
  <pre><code>[id]: http://example.com/ &quot;Optional Title Here&quot;
524
402
  </code></pre>
525
-
526
403
  <p>That is:</p>
527
404
 
528
405
  <ul>
529
- <li>Square brackets containing the link identifier (optionally indented from the left margin using spaces or tabs);</li>
406
+ <li>Square brackets containing the link identifier (optionally indented from the left margin using up to three spaces);</li>
530
407
 
531
408
  <li>followed by a colon;</li>
532
409
 
@@ -538,59 +415,42 @@ title attribute.<span class='punct'>&lt;/</span><span class='tag'>p</span><span
538
415
  </ul>
539
416
 
540
417
  <p>The following three link definitions are equivalent:</p>
541
-
542
418
  <pre><code>[foo]: http://example.com/ &quot;Optional Title Here&quot;
543
419
  [foo]: http://example.com/ &apos;Optional Title Here&apos;
544
420
  [foo]: http://example.com/ (Optional Title Here)
545
421
  </code></pre>
546
-
547
- <p><strong>Note:</strong> There is a known bug in Markdown 1.0.1 which prevents single quotes from being used to delimit link titles.</p>
422
+ <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>
548
423
 
549
424
  <p>The link URL may, optionally, be surrounded by angle brackets:</p>
550
-
551
425
  <pre><code>[id]: &lt;http://example.com/&gt; &quot;Optional Title Here&quot;
552
426
  </code></pre>
553
-
554
427
  <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>
555
-
556
428
  <pre><code>[id]: http://example.com/longish/path/to/resource/here
557
429
  &quot;Optional Title Here&quot;
558
430
  </code></pre>
559
-
560
431
  <p>Link definitions are only used for creating links during Markdown processing, and are stripped from your document in the HTML output.</p>
561
432
 
562
433
  <p>Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are <em>not</em> case sensitive. E.g. these two links:</p>
563
-
564
434
  <pre><code>[link text][a]
565
435
  [link text][A]
566
436
  </code></pre>
567
-
568
437
  <p>are equivalent.</p>
569
438
 
570
439
  <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 -- e.g., to link the word &quot;Google&quot; to the google.com web site, you could simply write:</p>
571
-
572
440
  <pre><code>[Google][]
573
441
  </code></pre>
574
-
575
442
  <p>And then define the link:</p>
576
-
577
443
  <pre><code>[Google]: http://google.com/
578
444
  </code></pre>
579
-
580
445
  <p>Because link names may contain spaces, this shortcut even works for multiple words in the link text:</p>
581
-
582
446
  <pre><code>Visit [Daring Fireball][] for more information.
583
447
  </code></pre>
584
-
585
448
  <p>And then define the link:</p>
586
-
587
449
  <pre><code>[Daring Fireball]: http://daringfireball.net/
588
450
  </code></pre>
589
-
590
451
  <p>Link definitions can be placed anywhere in your Markdown document. I tend to put them immediately after each paragraph in which they&apos;re used, but if you want, you can put them all at the end of your document, sort of like footnotes.</p>
591
452
 
592
453
  <p>Here&apos;s an example of reference links in action:</p>
593
-
594
454
  <pre><code>I get 10 times more traffic from [Google] [1] than from
595
455
  [Yahoo] [2] or [MSN] [3].
596
456
 
@@ -598,9 +458,7 @@ title attribute.<span class='punct'>&lt;/</span><span class='tag'>p</span><span
598
458
  [2]: http://search.yahoo.com/ &quot;Yahoo Search&quot;
599
459
  [3]: http://search.msn.com/ &quot;MSN Search&quot;
600
460
  </code></pre>
601
-
602
461
  <p>Using the implicit link name shortcut, you could instead write:</p>
603
-
604
462
  <pre><code>I get 10 times more traffic from [Google][] than from
605
463
  [Yahoo][] or [MSN][].
606
464
 
@@ -608,30 +466,22 @@ title attribute.<span class='punct'>&lt;/</span><span class='tag'>p</span><span
608
466
  [yahoo]: http://search.yahoo.com/ &quot;Yahoo Search&quot;
609
467
  [msn]: http://search.msn.com/ &quot;MSN Search&quot;
610
468
  </code></pre>
611
-
612
469
  <p>Both of the above examples will produce the following HTML output:</p>
613
-
614
470
  <pre><code>&lt;p&gt;I get 10 times more traffic from &lt;a href=&quot;http://google.com/&quot;
615
471
  title=&quot;Google&quot;&gt;Google&lt;/a&gt; than from
616
472
  &lt;a href=&quot;http://search.yahoo.com/&quot; title=&quot;Yahoo Search&quot;&gt;Yahoo&lt;/a&gt;
617
473
  or &lt;a href=&quot;http://search.msn.com/&quot; title=&quot;MSN Search&quot;&gt;MSN&lt;/a&gt;.&lt;/p&gt;
618
474
  </code></pre>
619
-
620
475
  <p>For comparison, here is the same paragraph written using Markdown&apos;s inline link style:</p>
621
-
622
476
  <pre><code>I get 10 times more traffic from [Google](http://google.com/ &quot;Google&quot;)
623
477
  than from [Yahoo](http://search.yahoo.com/ &quot;Yahoo Search&quot;) or
624
478
  [MSN](http://search.msn.com/ &quot;MSN Search&quot;).
625
479
  </code></pre>
626
-
627
480
  <p>The point of reference-style links is not that they&apos;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&apos;s 176 characters; and as raw HTML, it&apos;s 234 characters. In the raw HTML, there&apos;s more markup than there is text.</p>
628
481
 
629
482
  <p>With Markdown&apos;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>
630
-
631
- <h3 id='em'><span class='maruku_section_number'>3.2. </span>Emphasis</h3>
632
-
483
+ <h3 id='em'>Emphasis</h3>
633
484
  <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>&apos;s or <code>_</code>&apos;s will be wrapped with an HTML <code>&lt;strong&gt;</code> tag. E.g., this input:</p>
634
-
635
485
  <pre><code>*single asterisks*
636
486
 
637
487
  _single underscores_
@@ -640,90 +490,73 @@ _single underscores_
640
490
 
641
491
  __double underscores__
642
492
  </code></pre>
643
-
644
493
  <p>will produce:</p>
494
+ <pre><code>&lt;em&gt;single asterisks&lt;/em&gt;
645
495
 
646
- <pre class='xml'><span class='punct'>&lt;</span><span class='tag'>em</span><span class='punct'>&gt;</span>single asterisks<span class='punct'>&lt;/</span><span class='tag'>em</span><span class='punct'>&gt;</span>
647
-
648
- <span class='punct'>&lt;</span><span class='tag'>em</span><span class='punct'>&gt;</span>single underscores<span class='punct'>&lt;/</span><span class='tag'>em</span><span class='punct'>&gt;</span>
649
-
650
- <span class='punct'>&lt;</span><span class='tag'>strong</span><span class='punct'>&gt;</span>double asterisks<span class='punct'>&lt;/</span><span class='tag'>strong</span><span class='punct'>&gt;</span>
496
+ &lt;em&gt;single underscores&lt;/em&gt;
651
497
 
652
- <span class='punct'>&lt;</span><span class='tag'>strong</span><span class='punct'>&gt;</span>double underscores<span class='punct'>&lt;/</span><span class='tag'>strong</span><span class='punct'>&gt;</span></pre>
498
+ &lt;strong&gt;double asterisks&lt;/strong&gt;
653
499
 
500
+ &lt;strong&gt;double underscores&lt;/strong&gt;
501
+ </code></pre>
654
502
  <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>
655
503
 
656
504
  <p>Emphasis can be used in the middle of a word:</p>
657
-
658
505
  <pre><code>un*fucking*believable
659
506
  </code></pre>
660
-
661
507
  <p>But if you surround an <code>*</code> or <code>_</code> with spaces, it&apos;ll be treated as a literal asterisk or underscore.</p>
662
508
 
663
509
  <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>
664
-
665
510
  <pre><code>\*this text is surrounded by literal asterisks\*
666
511
 
667
512
 
668
- </code></pre>
669
-
670
- <h3 id='code'><span class='maruku_section_number'>3.3. </span>Code</h3>
671
-
513
+ </code></pre><h3 id='code'>Code</h3>
672
514
  <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>
673
-
674
515
  <pre><code>Use the `printf()` function.
675
516
  </code></pre>
676
-
677
517
  <p>will produce:</p>
678
-
679
- <pre class='xml'><span class='punct'>&lt;</span><span class='tag'>p</span><span class='punct'>&gt;</span>Use the <span class='punct'>&lt;</span><span class='tag'>code</span><span class='punct'>&gt;</span>printf()<span class='punct'>&lt;/</span><span class='tag'>code</span><span class='punct'>&gt;</span> function.<span class='punct'>&lt;/</span><span class='tag'>p</span><span class='punct'>&gt;</span></pre>
680
-
681
- <p>To include a literal backtick character within a code span, you can backslash escape it:</p>
682
-
683
- <pre><code>`There is a literal backtick (\\`) here.`
518
+ <pre><code>&lt;p&gt;Use the &lt;code&gt;printf()&lt;/code&gt; function.&lt;/p&gt;
684
519
  </code></pre>
685
-
686
- <p>Or, if you prefer, you can use multiple backticks as the opening and closing delimiters:</p>
687
-
520
+ <p>To include a literal backtick character within a code span, you can use multiple backticks as the opening and closing delimiters:</p>
688
521
  <pre><code>``There is a literal backtick (`) here.``
689
522
  </code></pre>
523
+ <p>which will produce this:</p>
524
+ <pre><code>&lt;p&gt;&lt;code&gt;There is a literal backtick (`) here.&lt;/code&gt;&lt;/p&gt;
525
+ </code></pre>
526
+ <p>The backtick delimiters surrounding a code span may include spaces -- 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>
527
+ <pre><code>A single backtick in a code span: `` ` ``
690
528
 
691
- <p>Both of the previous two examples will produce this:</p>
692
-
693
- <pre class='xml'><span class='punct'>&lt;</span><span class='tag'>p</span><span class='punct'>&gt;&lt;</span><span class='tag'>code</span><span class='punct'>&gt;</span>There is a literal backtick (`) here.<span class='punct'>&lt;/</span><span class='tag'>code</span><span class='punct'>&gt;&lt;/</span><span class='tag'>p</span><span class='punct'>&gt;</span></pre>
529
+ A backtick-delimited string in a code span: `` `foo` ``
530
+ </code></pre>
531
+ <p>will produce:</p>
532
+ <pre><code>&lt;p&gt;A single backtick in a code span: &lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
694
533
 
534
+ &lt;p&gt;A backtick-delimited string in a code span: &lt;code&gt;`foo`&lt;/code&gt;&lt;/p&gt;
535
+ </code></pre>
695
536
  <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>
696
-
697
537
  <pre><code>Please don&apos;t use any `&lt;blink&gt;` tags.
698
538
  </code></pre>
699
-
700
539
  <p>into:</p>
701
-
702
- <pre class='xml'><span class='punct'>&lt;</span><span class='tag'>p</span><span class='punct'>&gt;</span>Please don't use any <span class='punct'>&lt;</span><span class='tag'>code</span><span class='punct'>&gt;</span><span class='entity'>&amp;lt;</span>blink<span class='entity'>&amp;gt;</span><span class='punct'>&lt;/</span><span class='tag'>code</span><span class='punct'>&gt;</span> tags.<span class='punct'>&lt;/</span><span class='tag'>p</span><span class='punct'>&gt;</span></pre>
703
-
540
+ <pre><code>&lt;p&gt;Please don&apos;t use any &lt;code&gt;&amp;lt;blink&amp;gt;&lt;/code&gt; tags.&lt;/p&gt;
541
+ </code></pre>
704
542
  <p>You can write this:</p>
705
-
706
543
  <pre><code>`&amp;#8212;` is the decimal-encoded equivalent of `&amp;mdash;`.
707
544
  </code></pre>
708
-
709
545
  <p>to produce:</p>
546
+ <pre><code>&lt;p&gt;&lt;code&gt;&amp;amp;#8212;&lt;/code&gt; is the decimal-encoded
547
+ equivalent of &lt;code&gt;&amp;amp;mdash;&lt;/code&gt;.&lt;/p&gt;
710
548
 
711
- <pre class='xml'><span class='punct'>&lt;</span><span class='tag'>p</span><span class='punct'>&gt;&lt;</span><span class='tag'>code</span><span class='punct'>&gt;</span><span class='entity'>&amp;amp;#8212;</span><span class='punct'>&lt;/</span><span class='tag'>code</span><span class='punct'>&gt;</span> is the decimal-encoded
712
- equivalent of <span class='punct'>&lt;</span><span class='tag'>code</span><span class='punct'>&gt;</span><span class='entity'>&amp;amp;mdash;</span><span class='punct'>&lt;/</span><span class='tag'>code</span><span class='punct'>&gt;</span>.<span class='punct'>&lt;/</span><span class='tag'>p</span><span class='punct'>&gt;</span></pre>
713
-
714
- <h3 id='img'><span class='maruku_section_number'>3.4. </span>Images</h3>
715
549
 
550
+ </code></pre><h3 id='img'>Images</h3>
716
551
  <p>Admittedly, it&apos;s fairly difficult to devise a &quot;natural&quot; syntax for placing images into a plain text document format.</p>
717
552
 
718
553
  <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>
719
554
 
720
555
  <p>Inline image syntax looks like this:</p>
721
-
722
556
  <pre><code>![Alt text](/path/to/img.jpg)
723
557
 
724
558
  ![Alt text](/path/to/img.jpg &quot;Optional title&quot;)
725
559
  </code></pre>
726
-
727
560
  <p>That is:</p>
728
561
 
729
562
  <ul>
@@ -735,56 +568,35 @@ equivalent of <span class='punct'>&lt;</span><span class='tag'>code</span><span
735
568
  </ul>
736
569
 
737
570
  <p>Reference-style image syntax looks like this:</p>
738
-
739
571
  <pre><code>![Alt text][id]
740
572
  </code></pre>
741
-
742
573
  <p>Where &quot;id&quot; is the name of a defined image reference. Image references are defined using syntax identical to link references:</p>
743
-
744
574
  <pre><code>[id]: url/to/image &quot;Optional title attribute&quot;
745
575
  </code></pre>
746
-
747
576
  <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>
748
-
749
- <hr />
750
-
751
- <h2 id='misc'><span class='maruku_section_number'>4. </span>Miscellaneous</h2>
752
-
753
- <h3 id='autolink'><span class='maruku_section_number'>4.1. </span>Automatic Links</h3>
754
-
577
+ <hr /><h2 id='misc'>Miscellaneous</h2><h3 id='autolink'>Automatic Links</h3>
755
578
  <p>Markdown supports a shortcut style for creating &quot;automatic&quot; 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>
756
-
757
579
  <pre><code>&lt;http://example.com/&gt;</code></pre>
758
-
759
580
  <p>Markdown will turn this into:</p>
760
-
761
- <pre class='xml'><span class='punct'>&lt;</span><span class='tag'>a</span> <span class='attribute'>href</span><span class='punct'>=&quot;</span><span class='string'>http://example.com/</span><span class='punct'>&quot;&gt;</span>http://example.com/<span class='punct'>&lt;/</span><span class='tag'>a</span><span class='punct'>&gt;</span></pre>
762
-
581
+ <pre><code>&lt;a href=&quot;http://example.com/&quot;&gt;http://example.com/&lt;/a&gt;
582
+ </code></pre>
763
583
  <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>
764
-
765
584
  <pre><code>&lt;address@example.com&gt;
766
585
  </code></pre>
767
-
768
586
  <p>into something like this:</p>
769
-
770
- <pre class='xml'><span class='punct'>&lt;</span><span class='tag'>a</span> <span class='attribute'>href</span><span class='punct'>=&quot;</span><span class='entity'>&amp;#x6D;&amp;#x61;</span><span class='string'>i</span><span class='entity'>&amp;#x6C;&amp;#x74;&amp;#x6F;</span><span class='string'>:</span><span class='entity'>&amp;#x61;&amp;#x64;&amp;#x64;&amp;#x72;&amp;#x65;</span><span class='string'>
771
- </span><span class='entity'>&amp;#115;&amp;#115;&amp;#64;&amp;#101;&amp;#120;&amp;#x61;&amp;#109;&amp;#x70;&amp;#x6C;</span><span class='string'>e</span><span class='entity'>&amp;#x2E;&amp;#99;&amp;#111;</span><span class='string'>
772
- </span><span class='entity'>&amp;#109;</span><span class='punct'>&quot;&gt;</span><span class='entity'>&amp;#x61;&amp;#x64;&amp;#x64;&amp;#x72;&amp;#x65;&amp;#115;&amp;#115;&amp;#64;&amp;#101;&amp;#120;&amp;#x61;</span>
773
- <span class='entity'>&amp;#109;&amp;#x70;&amp;#x6C;</span>e<span class='entity'>&amp;#x2E;&amp;#99;&amp;#111;&amp;#109;</span><span class='punct'>&lt;/</span><span class='tag'>a</span><span class='punct'>&gt;</span></pre>
774
-
587
+ <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;
588
+ &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;
589
+ &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;
590
+ &amp;#109;&amp;#x70;&amp;#x6C;e&amp;#x2E;&amp;#99;&amp;#111;&amp;#109;&lt;/a&gt;
591
+ </code></pre>
775
592
  <p>which will render in a browser as a clickable link to &quot;address@example.com&quot;.</p>
776
593
 
777
594
  <p>(This sort of entity-encoding trick will indeed fool many, if not most, address-harvesting bots, but it definitely won&apos;t fool all of them. It&apos;s better than nothing, but an address published in this way will probably eventually start receiving spam.)</p>
778
-
779
- <h3 id='backslash'><span class='maruku_section_number'>4.2. </span>Backslash Escapes</h3>
780
-
595
+ <h3 id='backslash'>Backslash Escapes</h3>
781
596
  <p>Markdown allows you to use backslash escapes to generate literal characters which would otherwise have special meaning in Markdown&apos;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>
782
-
783
597
  <pre><code>\*literal asterisks\*
784
598
  </code></pre>
785
-
786
599
  <p>Markdown provides backslash escapes for the following characters:</p>
787
-
788
600
  <pre><code>\ backslash
789
601
  ` backtick
790
602
  * asterisk
@@ -793,10 +605,7 @@ _ underscore
793
605
  [] square brackets
794
606
  () parentheses
795
607
  # hash mark
608
+ + plus sign
609
+ - minus sign (hyphen)
796
610
  . dot
797
- ! exclamation mark</code></pre>
798
-
799
- <div class='maruku_signature'>
800
- <hr />
801
- <span style='font-size: small; font-style: italic'>Created by <a href='http://maruku.rubyforge.org' title='Maruku: a Markdown interpreter'>Maruku</a> at 00:21 on Wednesday, January 03rd, 2007.</span></div>
802
- </body></html>
611
+ ! exclamation mark</code></pre><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 interpreter'>Maruku</a> at 10:36 on Saturday, January 06th, 2007.</span></div></body></html>