git.iko.soy/typeable/pandoc
on master help sign in
Modified the HTML writer to add invisible anchors to each section
5cf769bfiddlosopher
@@ -261,6 +261,26 @@ markdown test suite, type `make test-markdown`.)
261
261
262[standard markdown]: http://daringfireball.net/projects/markdown/syntax
262[standard markdown]: http://daringfireball.net/projects/markdown/syntax
263
263
264+## Section Headings
265+
266+Pandoc creates an invisible anchor in front of every HTML section
267+heading. The ID of this anchor is derived from the section heading
268+itself: spaces are converted to underscores, and formatting, links,
269+and other markup are removed. Thus, for example, the source
270+
271+ ## Aristotle's *De Anima*
272+
273+gets converted to HTML as follows:
274+
275+ <a id="Aristotle's_De_Anima"></a>
276+ <h2>Aristotle's <em>De Anima</em></h2>
277+
278+This makes it easy to provide internal links that jump to a particular
279+place in a document. To provide a link to the heading above, for
280+example, just insert:
281+
282+ [Back to Aristotle](#Aristotle's_De_Anima)
283+
264## Lists
284## Lists
265
285
266Pandoc behaves differently from standard markdown on some "edge
286Pandoc behaves differently from standard markdown on some "edge
src/Text/Pandoc/Writers/HTML.hs+8−6
@@ -154,12 +154,14 @@ blockToHtml options (OrderedList lst) =
154 let attribs = if (writerIncremental options) then " class=\"incremental\"" else "" in
154 let attribs = if (writerIncremental options) then " class=\"incremental\"" else "" in
155 "<ol" ++ attribs ++ ">\n" ++ (concatMap (listItemToHtml options) lst) ++ "</ol>\n"
155 "<ol" ++ attribs ++ ">\n" ++ (concatMap (listItemToHtml options) lst) ++ "</ol>\n"
156blockToHtml options HorizontalRule = "<hr />\n"
156blockToHtml options HorizontalRule = "<hr />\n"
157−blockToHtml options (Header level lst) = if ((level > 0) && (level <= 6)) then
157+blockToHtml options (Header level lst) =
158+ let contents = inlineListToHtml options lst in
159+ let simplify = gsub "<[^>]*>" "" . gsub " " "_" in
160+ if ((level > 0) && (level <= 6))
161+ then "<a id=\"" ++ simplify contents ++ "\"></a>\n" ++
158− "<h" ++ (show level) ++ ">" ++
162+ "<h" ++ (show level) ++ ">" ++ contents ++
159− (inlineListToHtml options lst) ++
160− "</h" ++ (show level) ++ ">\n"
163+ "</h" ++ (show level) ++ ">\n"
161− else
164+ else "<p>" ++ contents ++ "</p>\n"
162− "<p>" ++ (inlineListToHtml options lst) ++ "</p>\n"
163listItemToHtml options list = "<li>" ++ (concatMap (blockToHtml options) list) ++ "</li>\n"
165listItemToHtml options list = "<li>" ++ (concatMap (blockToHtml options) list) ++ "</li>\n"
164
166
165-- | Convert list of Pandoc inline elements to HTML.
167-- | Convert list of Pandoc inline elements to HTML.
tests/s5.basic.html+8
@@ -723,18 +723,24 @@ window.onresize = function(){setTimeout('fontScale()', 50);}</script>
723<div id="currentSlide"></div>
723<div id="currentSlide"></div>
724<div id="header"></div>
724<div id="header"></div>
725<div id="footer">
725<div id="footer">
726+<a id="July_15,_2006"></a>
726<h1>July 15, 2006</h1>
727<h1>July 15, 2006</h1>
728+<a id="My_S5_Document"></a>
727<h2>My S5 Document</h2>
729<h2>My S5 Document</h2>
728</div>
730</div>
729</div>
731</div>
730<div class="presentation">
732<div class="presentation">
731
733
732<div class="slide">
734<div class="slide">
735+<a id="My_S5_Document"></a>
733<h1>My S5 Document</h1>
736<h1>My S5 Document</h1>
737+<a id="Sam_Smith,_Jen_Jones"></a>
734<h3>Sam Smith, Jen Jones</h3>
738<h3>Sam Smith, Jen Jones</h3>
739+<a id="July_15,_2006"></a>
735<h4>July 15, 2006</h4>
740<h4>July 15, 2006</h4>
736</div>
741</div>
737<div class="slide">
742<div class="slide">
743+<a id="First_slide"></a>
738<h1>First slide</h1>
744<h1>First slide</h1>
739<ul>
745<ul>
740<li>first bullet</li>
746<li>first bullet</li>
@@ -742,6 +748,7 @@ window.onresize = function(){setTimeout('fontScale()', 50);}</script>
742</ul>
748</ul>
743</div>
749</div>
744<div class="slide">
750<div class="slide">
751+<a id="Smarty"></a>
745<h1>Smarty</h1>
752<h1>Smarty</h1>
746<ul class="incremental">
753<ul class="incremental">
747<li>"Hello there"</li>
754<li>"Hello there"</li>
@@ -750,6 +757,7 @@ window.onresize = function(){setTimeout('fontScale()', 50);}</script>
750</ul>
757</ul>
751</div>
758</div>
752<div class="slide">
759<div class="slide">
760+<a id="Math"></a>
753<h1>Math</h1>
761<h1>Math</h1>
754<ul>
762<ul>
755<li>$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</li>
763<li>$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</li>
tests/s5.fancy.html+8
@@ -1635,18 +1635,24 @@ else
1635<div id="currentSlide"></div>
1635<div id="currentSlide"></div>
1636<div id="header"></div>
1636<div id="header"></div>
1637<div id="footer">
1637<div id="footer">
1638+<a id="July_15,_2006"></a>
1638<h1>July 15, 2006</h1>
1639<h1>July 15, 2006</h1>
1640+<a id="My_S5_Document"></a>
1639<h2>My S5 Document</h2>
1641<h2>My S5 Document</h2>
1640</div>
1642</div>
1641</div>
1643</div>
1642<div class="presentation">
1644<div class="presentation">
1643
1645
1644<div class="slide">
1646<div class="slide">
1647+<a id="My_S5_Document"></a>
1645<h1>My S5 Document</h1>
1648<h1>My S5 Document</h1>
1649+<a id="Sam_Smith,_Jen_Jones"></a>
1646<h3>Sam Smith, Jen Jones</h3>
1650<h3>Sam Smith, Jen Jones</h3>
1651+<a id="July_15,_2006"></a>
1647<h4>July 15, 2006</h4>
1652<h4>July 15, 2006</h4>
1648</div>
1653</div>
1649<div class="slide">
1654<div class="slide">
1655+<a id="First_slide"></a>
1650<h1>First slide</h1>
1656<h1>First slide</h1>
1651<ul class="incremental">
1657<ul class="incremental">
1652<li>first bullet</li>
1658<li>first bullet</li>
@@ -1654,6 +1660,7 @@ else
1654</ul>
1660</ul>
1655</div>
1661</div>
1656<div class="slide">
1662<div class="slide">
1663+<a id="Smarty"></a>
1657<h1>Smarty</h1>
1664<h1>Smarty</h1>
1658<ul>
1665<ul>
1659<li>&ldquo;Hello there&rdquo;</li>
1666<li>&ldquo;Hello there&rdquo;</li>
@@ -1662,6 +1669,7 @@ else
1662</ul>
1669</ul>
1663</div>
1670</div>
1664<div class="slide">
1671<div class="slide">
1672+<a id="Math"></a>
1665<h1>Math</h1>
1673<h1>Math</h1>
1666<ul class="incremental">
1674<ul class="incremental">
1667<li>$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</li>
1675<li>$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</li>
tests/s5.fragment.html+3
@@ -1,8 +1,10 @@
1+<a id="First_slide"></a>
1<h1>First slide</h1>
2<h1>First slide</h1>
2<ul>
3<ul>
3<li>first bullet</li>
4<li>first bullet</li>
4<li>second bullet</li>
5<li>second bullet</li>
5</ul>
6</ul>
7+<a id="Smarty"></a>
6<h1>Smarty</h1>
8<h1>Smarty</h1>
7<blockquote>
9<blockquote>
8<ul>
10<ul>
@@ -11,6 +13,7 @@
11<li>And 'ellipses'...</li>
13<li>And 'ellipses'...</li>
12</ul>
14</ul>
13</blockquote>
15</blockquote>
16+<a id="Math"></a>
14<h1>Math</h1>
17<h1>Math</h1>
15<ul>
18<ul>
16<li>$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</li>
19<li>$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</li>
tests/s5.inserts.html+3
@@ -13,11 +13,13 @@ STUFF INSERTED
13<body>
13<body>
14STUFF INSERTED
14STUFF INSERTED
15<h1 class="title">My S5 Document</h1>
15<h1 class="title">My S5 Document</h1>
16+<a id="First_slide"></a>
16<h1>First slide</h1>
17<h1>First slide</h1>
17<ul>
18<ul>
18<li>first bullet</li>
19<li>first bullet</li>
19<li>second bullet</li>
20<li>second bullet</li>
20</ul>
21</ul>
22+<a id="Smarty"></a>
21<h1>Smarty</h1>
23<h1>Smarty</h1>
22<blockquote>
24<blockquote>
23<ul>
25<ul>
@@ -26,6 +28,7 @@ STUFF INSERTED
26<li>And 'ellipses'...</li>
28<li>And 'ellipses'...</li>
27</ul>
29</ul>
28</blockquote>
30</blockquote>
31+<a id="Math"></a>
29<h1>Math</h1>
32<h1>Math</h1>
30<ul>
33<ul>
31<li>$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</li>
34<li>$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</li>
tests/writer.html+29
@@ -12,18 +12,28 @@
12<h1 class="title">Pandoc Test Suite</h1>
12<h1 class="title">Pandoc Test Suite</h1>
13<p>This is a set of tests for pandoc. Most of them are adapted from John Gruber's markdown test suite.</p>
13<p>This is a set of tests for pandoc. Most of them are adapted from John Gruber's markdown test suite.</p>
14<hr />
14<hr />
15+<a id="Headers"></a>
15<h1>Headers</h1>
16<h1>Headers</h1>
17+<a id="Level_2_with_an_embedded_link"></a>
16<h2>Level 2 with an <a href="/url">embedded link</a></h2>
18<h2>Level 2 with an <a href="/url">embedded link</a></h2>
19+<a id="Level_3_with_emphasis"></a>
17<h3>Level 3 with <em>emphasis</em></h3>
20<h3>Level 3 with <em>emphasis</em></h3>
21+<a id="Level_4"></a>
18<h4>Level 4</h4>
22<h4>Level 4</h4>
23+<a id="Level_5"></a>
19<h5>Level 5</h5>
24<h5>Level 5</h5>
25+<a id="Level_1"></a>
20<h1>Level 1</h1>
26<h1>Level 1</h1>
27+<a id="Level_2_with_emphasis"></a>
21<h2>Level 2 with <em>emphasis</em></h2>
28<h2>Level 2 with <em>emphasis</em></h2>
29+<a id="Level_3"></a>
22<h3>Level 3</h3>
30<h3>Level 3</h3>
23<p>with no blank line</p>
31<p>with no blank line</p>
32+<a id="Level_2"></a>
24<h2>Level 2</h2>
33<h2>Level 2</h2>
25<p>with no blank line</p>
34<p>with no blank line</p>
26<hr />
35<hr />
36+<a id="Paragraphs"></a>
27<h1>Paragraphs</h1>
37<h1>Paragraphs</h1>
28<p>Here's a regular paragraph.</p>
38<p>Here's a regular paragraph.</p>
29<p>In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Because a hard-wrapped line in the middle of a paragraph looked like a list item.</p>
39<p>In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Because a hard-wrapped line in the middle of a paragraph looked like a list item.</p>
@@ -31,6 +41,7 @@
31<p>There should be a hard line break<br />
41<p>There should be a hard line break<br />
32here.</p>
42here.</p>
33<hr />
43<hr />
44+<a id="Block_Quotes"></a>
34<h1>Block Quotes</h1>
45<h1>Block Quotes</h1>
35<p>E-mail style:</p>
46<p>E-mail style:</p>
36<blockquote>
47<blockquote>
@@ -79,6 +90,7 @@ here.</p>
79</blockquote>
90</blockquote>
80<p>And a following paragraph.</p>
91<p>And a following paragraph.</p>
81<hr />
92<hr />
93+<a id="Code_Blocks"></a>
82<h1>Code Blocks</h1>
94<h1>Code Blocks</h1>
83<p>Code:</p>
95<p>Code:</p>
84<pre><code>---- (should be four hyphens)
96<pre><code>---- (should be four hyphens)
@@ -95,7 +107,9 @@ this code block is indented by one tab
95These should not be escaped: \$ \\ \> \[ \{
107These should not be escaped: \$ \\ \> \[ \{
96</code></pre>
108</code></pre>
97<hr />
109<hr />
110+<a id="Lists"></a>
98<h1>Lists</h1>
111<h1>Lists</h1>
112+<a id="Unordered"></a>
99<h2>Unordered</h2>
113<h2>Unordered</h2>
100<p>Asterisks tight:</p>
114<p>Asterisks tight:</p>
101<ul>
115<ul>
@@ -142,6 +156,7 @@ These should not be escaped: \$ \\ \> \[ \{
142<li><p>Minus 3</p>
156<li><p>Minus 3</p>
143</li>
157</li>
144</ul>
158</ul>
159+<a id="Ordered"></a>
145<h2>Ordered</h2>
160<h2>Ordered</h2>
146<p>Tight:</p>
161<p>Tight:</p>
147<ol>
162<ol>
@@ -183,6 +198,7 @@ These should not be escaped: \$ \\ \> \[ \{
183<li><p>Item 3.</p>
198<li><p>Item 3.</p>
184</li>
199</li>
185</ol>
200</ol>
201+<a id="Nested"></a>
186<h2>Nested</h2>
202<h2>Nested</h2>
187<ul>
203<ul>
188<li>Tab<ul>
204<li>Tab<ul>
@@ -218,6 +234,7 @@ These should not be escaped: \$ \\ \> \[ \{
218<li><p>Third</p>
234<li><p>Third</p>
219</li>
235</li>
220</ol>
236</ol>
237+<a id="Tabs_and_spaces"></a>
221<h2>Tabs and spaces</h2>
238<h2>Tabs and spaces</h2>
222<ul>
239<ul>
223<li><p>this is a list item indented with tabs</p>
240<li><p>this is a list item indented with tabs</p>
@@ -232,6 +249,7 @@ These should not be escaped: \$ \\ \> \[ \{
232</li>
249</li>
233</ul>
250</ul>
234<hr />
251<hr />
252+<a id="HTML_Blocks"></a>
235<h1>HTML Blocks</h1>
253<h1>HTML Blocks</h1>
236<p>Simple block on one line:</p>
254<p>Simple block on one line:</p>
237<div>foo</div>
255<div>foo</div>
@@ -307,6 +325,7 @@ Blah
307
325
308<hr class="foo" id="bar">
326<hr class="foo" id="bar">
309<hr />
327<hr />
328+<a id="Inline_Markup"></a>
310<h1>Inline Markup</h1>
329<h1>Inline Markup</h1>
311<p>This is <em>emphasized</em>, and so <em>is this</em>.</p>
330<p>This is <em>emphasized</em>, and so <em>is this</em>.</p>
312<p>This is <strong>strong</strong>, and so <strong>is this</strong>.</p>
331<p>This is <strong>strong</strong>, and so <strong>is this</strong>.</p>
@@ -317,6 +336,7 @@ Blah
317<p>So is <strong><em>this</em></strong> word.</p>
336<p>So is <strong><em>this</em></strong> word.</p>
318<p>This is code: <code>></code>, <code>$</code>, <code>\</code>, <code>\$</code>, <code>&lt;html></code>.</p>
337<p>This is code: <code>></code>, <code>$</code>, <code>\</code>, <code>\$</code>, <code>&lt;html></code>.</p>
319<hr />
338<hr />
339+<a id="Smart_quotes,_ellipses,_dashes"></a>
320<h1>Smart quotes, ellipses, dashes</h1>
340<h1>Smart quotes, ellipses, dashes</h1>
321<p>"Hello," said the spider. "'Shelob' is my name."</p>
341<p>"Hello," said the spider. "'Shelob' is my name."</p>
322<p>'A', 'B', and 'C' are letters.</p>
342<p>'A', 'B', and 'C' are letters.</p>
@@ -327,6 +347,7 @@ Blah
327<p>Dashes between numbers: 5-7, 255-66, 1987-1999.</p>
347<p>Dashes between numbers: 5-7, 255-66, 1987-1999.</p>
328<p>Ellipses...and. . .and . . . .</p>
348<p>Ellipses...and. . .and . . . .</p>
329<hr />
349<hr />
350+<a id="LaTeX"></a>
330<h1>LaTeX</h1>
351<h1>LaTeX</h1>
331<ul>
352<ul>
332<li>\cite[22-23]{smith.1899}</li>
353<li>\cite[22-23]{smith.1899}</li>
@@ -352,6 +373,7 @@ Dog &amp; 2 \\
352Cat &amp; 1 \\ \hline
373Cat &amp; 1 \\ \hline
353\end{tabular}</p>
374\end{tabular}</p>
354<hr />
375<hr />
376+<a id="Special_Characters"></a>
355<h1>Special Characters</h1>
377<h1>Special Characters</h1>
356<p>Here is some unicode:</p>
378<p>Here is some unicode:</p>
357<ul>
379<ul>
@@ -383,7 +405,9 @@ Cat &amp; 1 \\ \hline
383<p>Plus: +</p>
405<p>Plus: +</p>
384<p>Minus: -</p>
406<p>Minus: -</p>
385<hr />
407<hr />
408+<a id="Links"></a>
386<h1>Links</h1>
409<h1>Links</h1>
410+<a id="Explicit"></a>
387<h2>Explicit</h2>
411<h2>Explicit</h2>
388<p>Just a <a href="/url/">URL</a>.</p>
412<p>Just a <a href="/url/">URL</a>.</p>
389<p><a href="/url/" title="title">URL and title</a>.</p>
413<p><a href="/url/" title="title">URL and title</a>.</p>
@@ -393,6 +417,7 @@ Cat &amp; 1 \\ \hline
393<p><a href="/url/" title="title with single quotes">URL and title</a></p>
417<p><a href="/url/" title="title with single quotes">URL and title</a></p>
394<p><script type="text/javascript">h='nowhere.net';n='nobody';e=n+'@'+h;document.write('<a href="mailto:'+e+'">'+'Email link'+'<\/a>');</script><noscript>Email link (nobody [at] nowhere.net)</noscript></p>
418<p><script type="text/javascript">h='nowhere.net';n='nobody';e=n+'@'+h;document.write('<a href="mailto:'+e+'">'+'Email link'+'<\/a>');</script><noscript>Email link (nobody [at] nowhere.net)</noscript></p>
395<p><a href="">Empty</a>.</p>
419<p><a href="">Empty</a>.</p>
420+<a id="Reference"></a>
396<h2>Reference</h2>
421<h2>Reference</h2>
397<p>Foo <a href="/url/">bar</a>.</p>
422<p>Foo <a href="/url/">bar</a>.</p>
398<p>Foo <a href="/url/">bar</a>.</p>
423<p>Foo <a href="/url/">bar</a>.</p>
@@ -407,11 +432,13 @@ Cat &amp; 1 \\ \hline
407</code></pre>
432</code></pre>
408<p>Foo <a href="/url/" title="Title with &quot;quotes&quot; inside">bar</a>.</p>
433<p>Foo <a href="/url/" title="Title with &quot;quotes&quot; inside">bar</a>.</p>
409<p>Foo <a href="/url/" title="Title with &quot;quote&quot; inside">biz</a>.</p>
434<p>Foo <a href="/url/" title="Title with &quot;quote&quot; inside">biz</a>.</p>
435+<a id="With_ampersands"></a>
410<h2>With ampersands</h2>
436<h2>With ampersands</h2>
411<p>Here's a <a href="http://example.com/?foo=1&amp;bar=2">link with an ampersand in the URL</a>.</p>
437<p>Here's a <a href="http://example.com/?foo=1&amp;bar=2">link with an ampersand in the URL</a>.</p>
412<p>Here's a link with an amersand in the link text: <a href="http://att.com/" title="AT&T">AT&amp;T</a>.</p>
438<p>Here's a link with an amersand in the link text: <a href="http://att.com/" title="AT&T">AT&amp;T</a>.</p>
413<p>Here's an <a href="/script?foo=1&amp;bar=2">inline link</a>.</p>
439<p>Here's an <a href="/script?foo=1&amp;bar=2">inline link</a>.</p>
414<p>Here's an <a href="/script?foo=1&amp;bar=2">inline link in pointy braces</a>.</p>
440<p>Here's an <a href="/script?foo=1&amp;bar=2">inline link in pointy braces</a>.</p>
441+<a id="Autolinks"></a>
415<h2>Autolinks</h2>
442<h2>Autolinks</h2>
416<p>With an ampersand: <a href="http://example.com/?foo=1&amp;bar=2">http://example.com/?foo=1&amp;bar=2</a></p>
443<p>With an ampersand: <a href="http://example.com/?foo=1&amp;bar=2">http://example.com/?foo=1&amp;bar=2</a></p>
417<ul>
444<ul>
@@ -427,11 +454,13 @@ Cat &amp; 1 \\ \hline
427<pre><code>or here: &lt;http://example.com/>
454<pre><code>or here: &lt;http://example.com/>
428</code></pre>
455</code></pre>
429<hr />
456<hr />
457+<a id="Images"></a>
430<h1>Images</h1>
458<h1>Images</h1>
431<p>From "Voyage dans la Lune" by Georges Melies (1902):</p>
459<p>From "Voyage dans la Lune" by Georges Melies (1902):</p>
432<p><img src="lalune.jpg" title="Voyage dans la Lune" alt="lalune"></p>
460<p><img src="lalune.jpg" title="Voyage dans la Lune" alt="lalune"></p>
433<p>Here is a movie <img src="movie.jpg" alt="movie"> icon.</p>
461<p>Here is a movie <img src="movie.jpg" alt="movie"> icon.</p>
434<hr />
462<hr />
463+<a id="Footnotes"></a>
435<h1>Footnotes</h1>
464<h1>Footnotes</h1>
436<p>Here is a footnote reference,<sup class="footnoteRef" id="fnref1"><a href="#fn1">1</a></sup> and another.<sup class="footnoteRef" id="fnref2"><a href="#fn2">2</a></sup> This should <em>not</em> be a footnote reference, because it contains a space.[^my note] Here is an inline note.<sup class="footnoteRef" id="fnref3"><a href="#fn3">3</a></sup></p>
465<p>Here is a footnote reference,<sup class="footnoteRef" id="fnref1"><a href="#fn1">1</a></sup> and another.<sup class="footnoteRef" id="fnref2"><a href="#fn2">2</a></sup> This should <em>not</em> be a footnote reference, because it contains a space.[^my note] Here is an inline note.<sup class="footnoteRef" id="fnref3"><a href="#fn3">3</a></sup></p>
437<p>This paragraph should not be part of the note, as it is not indented.</p>
466<p>This paragraph should not be part of the note, as it is not indented.</p>
tests/writer.smart.html+29
@@ -12,18 +12,28 @@
12<h1 class="title">Pandoc Test Suite</h1>
12<h1 class="title">Pandoc Test Suite</h1>
13<p>This is a set of tests for pandoc. Most of them are adapted from John Gruber&rsquo;s markdown test suite.</p>
13<p>This is a set of tests for pandoc. Most of them are adapted from John Gruber&rsquo;s markdown test suite.</p>
14<hr />
14<hr />
15+<a id="Headers"></a>
15<h1>Headers</h1>
16<h1>Headers</h1>
17+<a id="Level_2_with_an_embedded_link"></a>
16<h2>Level 2 with an <a href="/url">embedded link</a></h2>
18<h2>Level 2 with an <a href="/url">embedded link</a></h2>
19+<a id="Level_3_with_emphasis"></a>
17<h3>Level 3 with <em>emphasis</em></h3>
20<h3>Level 3 with <em>emphasis</em></h3>
21+<a id="Level_4"></a>
18<h4>Level 4</h4>
22<h4>Level 4</h4>
23+<a id="Level_5"></a>
19<h5>Level 5</h5>
24<h5>Level 5</h5>
25+<a id="Level_1"></a>
20<h1>Level 1</h1>
26<h1>Level 1</h1>
27+<a id="Level_2_with_emphasis"></a>
21<h2>Level 2 with <em>emphasis</em></h2>
28<h2>Level 2 with <em>emphasis</em></h2>
29+<a id="Level_3"></a>
22<h3>Level 3</h3>
30<h3>Level 3</h3>
23<p>with no blank line</p>
31<p>with no blank line</p>
32+<a id="Level_2"></a>
24<h2>Level 2</h2>
33<h2>Level 2</h2>
25<p>with no blank line</p>
34<p>with no blank line</p>
26<hr />
35<hr />
36+<a id="Paragraphs"></a>
27<h1>Paragraphs</h1>
37<h1>Paragraphs</h1>
28<p>Here&rsquo;s a regular paragraph.</p>
38<p>Here&rsquo;s a regular paragraph.</p>
29<p>In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Because a hard-wrapped line in the middle of a paragraph looked like a list item.</p>
39<p>In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Because a hard-wrapped line in the middle of a paragraph looked like a list item.</p>
@@ -31,6 +41,7 @@
31<p>There should be a hard line break<br />
41<p>There should be a hard line break<br />
32here.</p>
42here.</p>
33<hr />
43<hr />
44+<a id="Block_Quotes"></a>
34<h1>Block Quotes</h1>
45<h1>Block Quotes</h1>
35<p>E-mail style:</p>
46<p>E-mail style:</p>
36<blockquote>
47<blockquote>
@@ -79,6 +90,7 @@ here.</p>
79</blockquote>
90</blockquote>
80<p>And a following paragraph.</p>
91<p>And a following paragraph.</p>
81<hr />
92<hr />
93+<a id="Code_Blocks"></a>
82<h1>Code Blocks</h1>
94<h1>Code Blocks</h1>
83<p>Code:</p>
95<p>Code:</p>
84<pre><code>---- (should be four hyphens)
96<pre><code>---- (should be four hyphens)
@@ -95,7 +107,9 @@ this code block is indented by one tab
95These should not be escaped: \$ \\ \> \[ \{
107These should not be escaped: \$ \\ \> \[ \{
96</code></pre>
108</code></pre>
97<hr />
109<hr />
110+<a id="Lists"></a>
98<h1>Lists</h1>
111<h1>Lists</h1>
112+<a id="Unordered"></a>
99<h2>Unordered</h2>
113<h2>Unordered</h2>
100<p>Asterisks tight:</p>
114<p>Asterisks tight:</p>
101<ul>
115<ul>
@@ -142,6 +156,7 @@ These should not be escaped: \$ \\ \> \[ \{
142<li><p>Minus 3</p>
156<li><p>Minus 3</p>
143</li>
157</li>
144</ul>
158</ul>
159+<a id="Ordered"></a>
145<h2>Ordered</h2>
160<h2>Ordered</h2>
146<p>Tight:</p>
161<p>Tight:</p>
147<ol>
162<ol>
@@ -183,6 +198,7 @@ These should not be escaped: \$ \\ \> \[ \{
183<li><p>Item 3.</p>
198<li><p>Item 3.</p>
184</li>
199</li>
185</ol>
200</ol>
201+<a id="Nested"></a>
186<h2>Nested</h2>
202<h2>Nested</h2>
187<ul>
203<ul>
188<li>Tab<ul>
204<li>Tab<ul>
@@ -218,6 +234,7 @@ These should not be escaped: \$ \\ \> \[ \{
218<li><p>Third</p>
234<li><p>Third</p>
219</li>
235</li>
220</ol>
236</ol>
237+<a id="Tabs_and_spaces"></a>
221<h2>Tabs and spaces</h2>
238<h2>Tabs and spaces</h2>
222<ul>
239<ul>
223<li><p>this is a list item indented with tabs</p>
240<li><p>this is a list item indented with tabs</p>
@@ -232,6 +249,7 @@ These should not be escaped: \$ \\ \> \[ \{
232</li>
249</li>
233</ul>
250</ul>
234<hr />
251<hr />
252+<a id="HTML_Blocks"></a>
235<h1>HTML Blocks</h1>
253<h1>HTML Blocks</h1>
236<p>Simple block on one line:</p>
254<p>Simple block on one line:</p>
237<div>foo</div>
255<div>foo</div>
@@ -307,6 +325,7 @@ Blah
307
325
308<hr class="foo" id="bar">
326<hr class="foo" id="bar">
309<hr />
327<hr />
328+<a id="Inline_Markup"></a>
310<h1>Inline Markup</h1>
329<h1>Inline Markup</h1>
311<p>This is <em>emphasized</em>, and so <em>is this</em>.</p>
330<p>This is <em>emphasized</em>, and so <em>is this</em>.</p>
312<p>This is <strong>strong</strong>, and so <strong>is this</strong>.</p>
331<p>This is <strong>strong</strong>, and so <strong>is this</strong>.</p>
@@ -317,6 +336,7 @@ Blah
317<p>So is <strong><em>this</em></strong> word.</p>
336<p>So is <strong><em>this</em></strong> word.</p>
318<p>This is code: <code>></code>, <code>$</code>, <code>\</code>, <code>\$</code>, <code>&lt;html></code>.</p>
337<p>This is code: <code>></code>, <code>$</code>, <code>\</code>, <code>\$</code>, <code>&lt;html></code>.</p>
319<hr />
338<hr />
339+<a id="Smart_quotes,_ellipses,_dashes"></a>
320<h1>Smart quotes, ellipses, dashes</h1>
340<h1>Smart quotes, ellipses, dashes</h1>
321<p>&ldquo;Hello,&rdquo; said the spider. &ldquo;&lsquo;Shelob&rsquo; is my name.&rdquo;</p>
341<p>&ldquo;Hello,&rdquo; said the spider. &ldquo;&lsquo;Shelob&rsquo; is my name.&rdquo;</p>
322<p>&lsquo;A&rsquo;, &lsquo;B&rsquo;, and &lsquo;C&rsquo; are letters.</p>
342<p>&lsquo;A&rsquo;, &lsquo;B&rsquo;, and &lsquo;C&rsquo; are letters.</p>
@@ -327,6 +347,7 @@ Blah
327<p>Dashes between numbers: 5&ndash;7, 255&ndash;66, 1987&ndash;1999.</p>
347<p>Dashes between numbers: 5&ndash;7, 255&ndash;66, 1987&ndash;1999.</p>
328<p>Ellipses&hellip;and&hellip;and &hellip; .</p>
348<p>Ellipses&hellip;and&hellip;and &hellip; .</p>
329<hr />
349<hr />
350+<a id="LaTeX"></a>
330<h1>LaTeX</h1>
351<h1>LaTeX</h1>
331<ul>
352<ul>
332<li>\cite[22-23]{smith.1899}</li>
353<li>\cite[22-23]{smith.1899}</li>
@@ -352,6 +373,7 @@ Dog &amp; 2 \\
352Cat &amp; 1 \\ \hline
373Cat &amp; 1 \\ \hline
353\end{tabular}</p>
374\end{tabular}</p>
354<hr />
375<hr />
376+<a id="Special_Characters"></a>
355<h1>Special Characters</h1>
377<h1>Special Characters</h1>
356<p>Here is some unicode:</p>
378<p>Here is some unicode:</p>
357<ul>
379<ul>
@@ -383,7 +405,9 @@ Cat &amp; 1 \\ \hline
383<p>Plus: +</p>
405<p>Plus: +</p>
384<p>Minus: -</p>
406<p>Minus: -</p>
385<hr />
407<hr />
408+<a id="Links"></a>
386<h1>Links</h1>
409<h1>Links</h1>
410+<a id="Explicit"></a>
387<h2>Explicit</h2>
411<h2>Explicit</h2>
388<p>Just a <a href="/url/">URL</a>.</p>
412<p>Just a <a href="/url/">URL</a>.</p>
389<p><a href="/url/" title="title">URL and title</a>.</p>
413<p><a href="/url/" title="title">URL and title</a>.</p>
@@ -393,6 +417,7 @@ Cat &amp; 1 \\ \hline
393<p><a href="/url/" title="title with single quotes">URL and title</a></p>
417<p><a href="/url/" title="title with single quotes">URL and title</a></p>
394<p><script type="text/javascript">h='nowhere.net';n='nobody';e=n+'@'+h;document.write('<a href="mailto:'+e+'">'+'Email link'+'<\/a>');</script><noscript>Email link (nobody [at] nowhere.net)</noscript></p>
418<p><script type="text/javascript">h='nowhere.net';n='nobody';e=n+'@'+h;document.write('<a href="mailto:'+e+'">'+'Email link'+'<\/a>');</script><noscript>Email link (nobody [at] nowhere.net)</noscript></p>
395<p><a href="">Empty</a>.</p>
419<p><a href="">Empty</a>.</p>
420+<a id="Reference"></a>
396<h2>Reference</h2>
421<h2>Reference</h2>
397<p>Foo <a href="/url/">bar</a>.</p>
422<p>Foo <a href="/url/">bar</a>.</p>
398<p>Foo <a href="/url/">bar</a>.</p>
423<p>Foo <a href="/url/">bar</a>.</p>
@@ -407,11 +432,13 @@ Cat &amp; 1 \\ \hline
407</code></pre>
432</code></pre>
408<p>Foo <a href="/url/" title="Title with &quot;quotes&quot; inside">bar</a>.</p>
433<p>Foo <a href="/url/" title="Title with &quot;quotes&quot; inside">bar</a>.</p>
409<p>Foo <a href="/url/" title="Title with &quot;quote&quot; inside">biz</a>.</p>
434<p>Foo <a href="/url/" title="Title with &quot;quote&quot; inside">biz</a>.</p>
435+<a id="With_ampersands"></a>
410<h2>With ampersands</h2>
436<h2>With ampersands</h2>
411<p>Here&rsquo;s a <a href="http://example.com/?foo=1&amp;bar=2">link with an ampersand in the URL</a>.</p>
437<p>Here&rsquo;s a <a href="http://example.com/?foo=1&amp;bar=2">link with an ampersand in the URL</a>.</p>
412<p>Here&rsquo;s a link with an amersand in the link text: <a href="http://att.com/" title="AT&T">AT&amp;T</a>.</p>
438<p>Here&rsquo;s a link with an amersand in the link text: <a href="http://att.com/" title="AT&T">AT&amp;T</a>.</p>
413<p>Here&rsquo;s an <a href="/script?foo=1&amp;bar=2">inline link</a>.</p>
439<p>Here&rsquo;s an <a href="/script?foo=1&amp;bar=2">inline link</a>.</p>
414<p>Here&rsquo;s an <a href="/script?foo=1&amp;bar=2">inline link in pointy braces</a>.</p>
440<p>Here&rsquo;s an <a href="/script?foo=1&amp;bar=2">inline link in pointy braces</a>.</p>
441+<a id="Autolinks"></a>
415<h2>Autolinks</h2>
442<h2>Autolinks</h2>
416<p>With an ampersand: <a href="http://example.com/?foo=1&amp;bar=2">http://example.com/?foo=1&amp;bar=2</a></p>
443<p>With an ampersand: <a href="http://example.com/?foo=1&amp;bar=2">http://example.com/?foo=1&amp;bar=2</a></p>
417<ul>
444<ul>
@@ -427,11 +454,13 @@ Cat &amp; 1 \\ \hline
427<pre><code>or here: &lt;http://example.com/>
454<pre><code>or here: &lt;http://example.com/>
428</code></pre>
455</code></pre>
429<hr />
456<hr />
457+<a id="Images"></a>
430<h1>Images</h1>
458<h1>Images</h1>
431<p>From &ldquo;Voyage dans la Lune&rdquo; by Georges Melies (1902):</p>
459<p>From &ldquo;Voyage dans la Lune&rdquo; by Georges Melies (1902):</p>
432<p><img src="lalune.jpg" title="Voyage dans la Lune" alt="lalune"></p>
460<p><img src="lalune.jpg" title="Voyage dans la Lune" alt="lalune"></p>
433<p>Here is a movie <img src="movie.jpg" alt="movie"> icon.</p>
461<p>Here is a movie <img src="movie.jpg" alt="movie"> icon.</p>
434<hr />
462<hr />
463+<a id="Footnotes"></a>
435<h1>Footnotes</h1>
464<h1>Footnotes</h1>
436<p>Here is a footnote reference,<sup class="footnoteRef" id="fnref1"><a href="#fn1">1</a></sup> and another.<sup class="footnoteRef" id="fnref2"><a href="#fn2">2</a></sup> This should <em>not</em> be a footnote reference, because it contains a space.[^my note] Here is an inline note.<sup class="footnoteRef" id="fnref3"><a href="#fn3">3</a></sup></p>
465<p>Here is a footnote reference,<sup class="footnoteRef" id="fnref1"><a href="#fn1">1</a></sup> and another.<sup class="footnoteRef" id="fnref2"><a href="#fn2">2</a></sup> This should <em>not</em> be a footnote reference, because it contains a space.[^my note] Here is an inline note.<sup class="footnoteRef" id="fnref3"><a href="#fn3">3</a></sup></p>
437<p>This paragraph should not be part of the note, as it is not indented.</p>
466<p>This paragraph should not be part of the note, as it is not indented.</p>