git.iko.soy/typeable/pandoc
on master help sign in
Markdown writer: More improvements to 'plain' output, updated tests.
c302ab3John MacFarlane
src/Text/Pandoc/Writers/Markdown.hs+26−21
@@ -37,7 +37,7 @@ import Text.Pandoc.Templates (renderTemplate')
37import Text.Pandoc.Shared
37import Text.Pandoc.Shared
38import Text.Pandoc.Writers.Shared
38import Text.Pandoc.Writers.Shared
39import Text.Pandoc.Options
39import Text.Pandoc.Options
40−import Text.Pandoc.Parsing hiding (blankline, char, space)
40+import Text.Pandoc.Parsing hiding (blankline, blanklines, char, space)
41import Data.List ( group, isPrefixOf, find, intersperse, transpose, sortBy )
41import Data.List ( group, isPrefixOf, find, intersperse, transpose, sortBy )
42import Data.Char ( isSpace, isPunctuation, toUpper )
42import Data.Char ( isSpace, isPunctuation, toUpper )
43import Data.Ord ( comparing )
43import Data.Ord ( comparing )
@@ -79,6 +79,9 @@ writePlain opts document =
79 writerExtensions = Set.delete Ext_escaped_line_breaks $
79 writerExtensions = Set.delete Ext_escaped_line_breaks $
80 Set.delete Ext_pipe_tables $
80 Set.delete Ext_pipe_tables $
81 Set.delete Ext_raw_html $
81 Set.delete Ext_raw_html $
82+ Set.delete Ext_footnotes $
83+ Set.delete Ext_tex_math_dollars $
84+ Set.delete Ext_citations $
82 writerExtensions opts }
85 writerExtensions opts }
83 document) def{ stPlain = True }
86 document) def{ stPlain = True }
84
87
@@ -171,7 +174,7 @@ pandocToMarkdown opts (Pandoc meta blocks) = do
171 then tableOfContents opts headerBlocks
174 then tableOfContents opts headerBlocks
172 else empty
175 else empty
173 -- Strip off final 'references' header if markdown citations enabled
176 -- Strip off final 'references' header if markdown citations enabled
174− let blocks' = if not isPlain && isEnabled Ext_citations opts
177+ let blocks' = if isEnabled Ext_citations opts
175 then case reverse blocks of
178 then case reverse blocks of
176 (Div (_,["references"],_) _):xs -> reverse xs
179 (Div (_,["references"],_) _):xs -> reverse xs
177 _ -> blocks
180 _ -> blocks
@@ -355,11 +358,11 @@ blockToMarkdown opts (Header level attr inlines) = do
355 let setext = writerSetextHeaders opts
358 let setext = writerSetextHeaders opts
356 return $ nowrap
359 return $ nowrap
357 $ case level of
360 $ case level of
358− 1 | plain -> blankline <> text "\n\n" <> contents <> blankline <> text "\n"
361+ 1 | plain -> blanklines 3 <> contents <> blanklines 2
359 | setext ->
362 | setext ->
360 contents <> attr' <> cr <> text (replicate (offset contents) '=') <>
363 contents <> attr' <> cr <> text (replicate (offset contents) '=') <>
361 blankline
364 blankline
362− 2 | plain -> blankline <> text "\n" <> contents <> blankline
365+ 2 | plain -> blanklines 2 <> contents <> blankline
363 | setext ->
366 | setext ->
364 contents <> attr' <> cr <> text (replicate (offset contents) '-') <>
367 contents <> attr' <> cr <> text (replicate (offset contents) '-') <>
365 blankline
368 blankline
@@ -695,23 +698,15 @@ inlineToMarkdown opts (Strikeout lst) = do
695 then "~~" <> contents <> "~~"
698 then "~~" <> contents <> "~~"
696 else "<s>" <> contents <> "</s>"
699 else "<s>" <> contents <> "</s>"
697inlineToMarkdown opts (Superscript lst) = do
700inlineToMarkdown opts (Superscript lst) = do
698− plain <- gets stPlain
699− if plain
700− then inlineListToMarkdown opts lst
701− else do
702− contents <- inlineListToMarkdown opts $ walk escapeSpaces lst
701+ contents <- inlineListToMarkdown opts $ walk escapeSpaces lst
703− return $ if isEnabled Ext_superscript opts
702+ return $ if isEnabled Ext_superscript opts
704− then "^" <> contents <> "^"
703+ then "^" <> contents <> "^"
705− else "<sup>" <> contents <> "</sup>"
704+ else "<sup>" <> contents <> "</sup>"
706inlineToMarkdown opts (Subscript lst) = do
705inlineToMarkdown opts (Subscript lst) = do
707− plain <- gets stPlain
708− if plain
709− then inlineListToMarkdown opts lst
710− else do
711− contents <- inlineListToMarkdown opts $ walk escapeSpaces lst
706+ contents <- inlineListToMarkdown opts $ walk escapeSpaces lst
712− return $ if isEnabled Ext_subscript opts
707+ return $ if isEnabled Ext_subscript opts
713− then "~" <> contents <> "~"
708+ then "~" <> contents <> "~"
714− else "<sub>" <> contents <> "</sub>"
709+ else "<sub>" <> contents <> "</sub>"
715inlineToMarkdown opts (SmallCaps lst) = do
710inlineToMarkdown opts (SmallCaps lst) = do
716 plain <- gets stPlain
711 plain <- gets stPlain
717 if plain
712 if plain
@@ -753,7 +748,11 @@ inlineToMarkdown opts (Math InlineMath str)
753 return $ "\\(" <> text str <> "\\)"
748 return $ "\\(" <> text str <> "\\)"
754 | isEnabled Ext_tex_math_double_backslash opts =
749 | isEnabled Ext_tex_math_double_backslash opts =
755 return $ "\\\\(" <> text str <> "\\\\)"
750 return $ "\\\\(" <> text str <> "\\\\)"
751+ | otherwise = do
752+ plain <- gets stPlain
753+ inlineListToMarkdown opts $
754+ (if plain then makeMathPlainer else id) $
756− | otherwise = inlineListToMarkdown opts $ texMathToInlines InlineMath str
755+ texMathToInlines InlineMath str
757inlineToMarkdown opts (Math DisplayMath str)
756inlineToMarkdown opts (Math DisplayMath str)
758 | isEnabled Ext_tex_math_dollars opts =
757 | isEnabled Ext_tex_math_dollars opts =
759 return $ "$$" <> text str <> "$$"
758 return $ "$$" <> text str <> "$$"
@@ -853,3 +852,9 @@ inlineToMarkdown opts (Note contents) = do
853 if isEnabled Ext_footnotes opts
852 if isEnabled Ext_footnotes opts
854 then return $ "[^" <> ref <> "]"
853 then return $ "[^" <> ref <> "]"
855 else return $ "[" <> ref <> "]"
854 else return $ "[" <> ref <> "]"
855+
856+makeMathPlainer :: [Inline] -> [Inline]
857+makeMathPlainer = walk go
858+ where
859+ go (Emph xs) = Span nullAttr xs
860+ go x = x
tests/writer.markdown+27−13
@@ -9,7 +9,7 @@ title: Pandoc Test Suite
9This is a set of tests for pandoc. Most of them are adapted from John Gruber’s
9This is a set of tests for pandoc. Most of them are adapted from John Gruber’s
10markdown test suite.
10markdown test suite.
11
11
12−* * * * *
12+------------------------------------------------------------------------------
13
13
14Headers
14Headers
15=======
15=======
@@ -38,7 +38,7 @@ Level 2
38
38
39with no blank line
39with no blank line
40
40
41−* * * * *
41+------------------------------------------------------------------------------
42
42
43Paragraphs
43Paragraphs
44==========
44==========
@@ -54,7 +54,7 @@ Here’s one with a bullet. \* criminey.
54There should be a hard line break\
54There should be a hard line break\
55here.
55here.
56
56
57−* * * * *
57+------------------------------------------------------------------------------
58
58
59Block Quotes
59Block Quotes
60============
60============
@@ -84,7 +84,7 @@ This should not be a block quote: 2 \> 1.
84
84
85And a following paragraph.
85And a following paragraph.
86
86
87−* * * * *
87+------------------------------------------------------------------------------
88
88
89Code Blocks
89Code Blocks
90===========
90===========
@@ -105,7 +105,7 @@ And:
105
105
106 These should not be escaped: \$ \\ \> \[ \{
106 These should not be escaped: \$ \\ \> \[ \{
107
107
108−* * * * *
108+------------------------------------------------------------------------------
109
109
110Lists
110Lists
111=====
111=====
@@ -268,7 +268,7 @@ M.A. 2007
268
268
269B. Williams
269B. Williams
270
270
271−* * * * *
271+------------------------------------------------------------------------------
272
272
273Definition Lists
273Definition Lists
274================
274================
@@ -277,8 +277,10 @@ Tight using spaces:
277
277
278apple
278apple
279: red fruit
279: red fruit
280+
280orange
281orange
281: orange fruit
282: orange fruit
283+
282banana
284banana
283: yellow fruit
285: yellow fruit
284
286
@@ -286,30 +288,37 @@ Tight using tabs:
286
288
287apple
289apple
288: red fruit
290: red fruit
291+
289orange
292orange
290: orange fruit
293: orange fruit
294+
291banana
295banana
292: yellow fruit
296: yellow fruit
293
297
294Loose:
298Loose:
295
299
296apple
300apple
301+
297: red fruit
302: red fruit
298
303
299orange
304orange
305+
300: orange fruit
306: orange fruit
301
307
302banana
308banana
309+
303: yellow fruit
310: yellow fruit
304
311
305Multiple blocks with italics:
312Multiple blocks with italics:
306
313
307*apple*
314*apple*
315+
308: red fruit
316: red fruit
309
317
310 contains seeds, crisp, pleasant to taste
318 contains seeds, crisp, pleasant to taste
311
319
312*orange*
320*orange*
321+
313: orange fruit
322: orange fruit
314
323
315 { orange code block }
324 { orange code block }
@@ -321,6 +330,7 @@ Multiple definitions, tight:
321apple
330apple
322: red fruit
331: red fruit
323: computer
332: computer
333+
324orange
334orange
325: orange fruit
335: orange fruit
326: bank
336: bank
@@ -328,11 +338,13 @@ orange
328Multiple definitions, loose:
338Multiple definitions, loose:
329
339
330apple
340apple
341+
331: red fruit
342: red fruit
332
343
333: computer
344: computer
334
345
335orange
346orange
347+
336: orange fruit
348: orange fruit
337
349
338: bank
350: bank
@@ -340,11 +352,13 @@ orange
340Blank line after term, indented marker, alternate markers:
352Blank line after term, indented marker, alternate markers:
341
353
342apple
354apple
355+
343: red fruit
356: red fruit
344
357
345: computer
358: computer
346
359
347orange
360orange
361+
348: orange fruit
362: orange fruit
349
363
350 1. sublist
364 1. sublist
@@ -465,7 +479,7 @@ Hr’s:
465<hr class="foo" id="bar" />
479<hr class="foo" id="bar" />
466<hr class="foo" id="bar">
480<hr class="foo" id="bar">
467
481
468−* * * * *
482+------------------------------------------------------------------------------
469
483
470Inline Markup
484Inline Markup
471=============
485=============
@@ -495,7 +509,7 @@ Subscripts: H~2~O, H~23~O, H~many of them~O.
495These should not be superscripts or subscripts, because of the unescaped
509These should not be superscripts or subscripts, because of the unescaped
496spaces: a\^b c\^d, a\~b c\~d.
510spaces: a\^b c\^d, a\~b c\~d.
497
511
498−* * * * *
512+------------------------------------------------------------------------------
499
513
500Smart quotes, ellipses, dashes
514Smart quotes, ellipses, dashes
501==============================
515==============================
@@ -517,7 +531,7 @@ Dashes between numbers: 5–7, 255–66, 1987–1999.
517
531
518Ellipses…and…and….
532Ellipses…and…and….
519
533
520−* * * * *
534+------------------------------------------------------------------------------
521
535
522LaTeX
536LaTeX
523=====
537=====
@@ -548,7 +562,7 @@ Dog & 2 \\
548Cat & 1 \\ \hline
562Cat & 1 \\ \hline
549\end{tabular}
563\end{tabular}
550
564
551−* * * * *
565+------------------------------------------------------------------------------
552
566
553Special Characters
567Special Characters
554==================
568==================
@@ -603,7 +617,7 @@ Plus: +
603
617
604Minus: -
618Minus: -
605
619
606−* * * * *
620+------------------------------------------------------------------------------
607
621
608Links
622Links
609=====
623=====
@@ -685,7 +699,7 @@ Auto-links should not occur here: `<http://example.com/>`
685
699
686 or here: <http://example.com/>
700 or here: <http://example.com/>
687
701
688−* * * * *
702+------------------------------------------------------------------------------
689
703
690Images
704Images
691======
705======
@@ -696,7 +710,7 @@ From “Voyage dans la Lune” by Georges Melies (1902):
696
710
697Here is a movie ![movie](movie.jpg) icon.
711Here is a movie ![movie](movie.jpg) icon.
698
712
699−* * * * *
713+------------------------------------------------------------------------------
700
714
701Footnotes
715Footnotes
702=========
716=========
tests/writer.opml+13−13
@@ -21,14 +21,14 @@
21 <outline text="Level 3" _note="with no blank line&#10;">
21 <outline text="Level 3" _note="with no blank line&#10;">
22 </outline>
22 </outline>
23 </outline>
23 </outline>
24− <outline text="Level 2" _note="with no blank line&#10;&#10;* * * * *">
24+ <outline text="Level 2" _note="with no blank line&#10;&#10;------------------------------------------------------------------------">
25 </outline>
25 </outline>
26</outline>
26</outline>
27−<outline text="Paragraphs" _note="Here’s a regular paragraph.&#10;&#10;In Markdown 1.0.0 and earlier. Version 8. This line turns into a list&#10;item. Because a hard-wrapped line in the middle of a paragraph looked&#10;like a list item.&#10;&#10;Here’s one with a bullet. \* criminey.&#10;&#10;There should be a hard line break\&#10;here.&#10;&#10;* * * * *">
27+<outline text="Paragraphs" _note="Here’s a regular paragraph.&#10;&#10;In Markdown 1.0.0 and earlier. Version 8. This line turns into a list&#10;item. Because a hard-wrapped line in the middle of a paragraph looked&#10;like a list item.&#10;&#10;Here’s one with a bullet. \* criminey.&#10;&#10;There should be a hard line break\&#10;here.&#10;&#10;------------------------------------------------------------------------">
28</outline>
28</outline>
29−<outline text="Block Quotes" _note="E-mail style:&#10;&#10;&gt; This is a block quote. It is pretty short.&#10;&#10;&gt; Code in a block quote:&#10;&gt;&#10;&gt; sub status {&#10;&gt; print &quot;working&quot;;&#10;&gt; }&#10;&gt;&#10;&gt; A list:&#10;&gt;&#10;&gt; 1. item one&#10;&gt; 2. item two&#10;&gt;&#10;&gt; Nested block quotes:&#10;&gt;&#10;&gt; &gt; nested&#10;&gt;&#10;&gt; &gt; nested&#10;&#10;This should not be a block quote: 2 \&gt; 1.&#10;&#10;And a following paragraph.&#10;&#10;* * * * *">
29+<outline text="Block Quotes" _note="E-mail style:&#10;&#10;&gt; This is a block quote. It is pretty short.&#10;&#10;&gt; Code in a block quote:&#10;&gt;&#10;&gt; sub status {&#10;&gt; print &quot;working&quot;;&#10;&gt; }&#10;&gt;&#10;&gt; A list:&#10;&gt;&#10;&gt; 1. item one&#10;&gt; 2. item two&#10;&gt;&#10;&gt; Nested block quotes:&#10;&gt;&#10;&gt; &gt; nested&#10;&gt;&#10;&gt; &gt; nested&#10;&#10;This should not be a block quote: 2 \&gt; 1.&#10;&#10;And a following paragraph.&#10;&#10;------------------------------------------------------------------------">
30</outline>
30</outline>
31−<outline text="Code Blocks" _note="Code:&#10;&#10; ---- (should be four hyphens)&#10;&#10; sub status {&#10; print &quot;working&quot;;&#10; }&#10;&#10; this code block is indented by one tab&#10;&#10;And:&#10;&#10; this code block is indented by two tabs&#10;&#10; These should not be escaped: \$ \\ \&gt; \[ \{&#10;&#10;* * * * *">
31+<outline text="Code Blocks" _note="Code:&#10;&#10; ---- (should be four hyphens)&#10;&#10; sub status {&#10; print &quot;working&quot;;&#10; }&#10;&#10; this code block is indented by one tab&#10;&#10;And:&#10;&#10; this code block is indented by two tabs&#10;&#10; These should not be escaped: \$ \\ \&gt; \[ \{&#10;&#10;------------------------------------------------------------------------">
32</outline>
32</outline>
33<outline text="Lists">
33<outline text="Lists">
34 <outline text="Unordered" _note="Asterisks tight:&#10;&#10;- asterisk 1&#10;- asterisk 2&#10;- asterisk 3&#10;&#10;Asterisks loose:&#10;&#10;- asterisk 1&#10;&#10;- asterisk 2&#10;&#10;- asterisk 3&#10;&#10;Pluses tight:&#10;&#10;- Plus 1&#10;- Plus 2&#10;- Plus 3&#10;&#10;Pluses loose:&#10;&#10;- Plus 1&#10;&#10;- Plus 2&#10;&#10;- Plus 3&#10;&#10;Minuses tight:&#10;&#10;- Minus 1&#10;- Minus 2&#10;- Minus 3&#10;&#10;Minuses loose:&#10;&#10;- Minus 1&#10;&#10;- Minus 2&#10;&#10;- Minus 3&#10;&#10;">
34 <outline text="Unordered" _note="Asterisks tight:&#10;&#10;- asterisk 1&#10;- asterisk 2&#10;- asterisk 3&#10;&#10;Asterisks loose:&#10;&#10;- asterisk 1&#10;&#10;- asterisk 2&#10;&#10;- asterisk 3&#10;&#10;Pluses tight:&#10;&#10;- Plus 1&#10;- Plus 2&#10;- Plus 3&#10;&#10;Pluses loose:&#10;&#10;- Plus 1&#10;&#10;- Plus 2&#10;&#10;- Plus 3&#10;&#10;Minuses tight:&#10;&#10;- Minus 1&#10;- Minus 2&#10;- Minus 3&#10;&#10;Minuses loose:&#10;&#10;- Minus 1&#10;&#10;- Minus 2&#10;&#10;- Minus 3&#10;&#10;">
@@ -39,20 +39,20 @@
39 </outline>
39 </outline>
40 <outline text="Tabs and spaces" _note="- this is a list item indented with tabs&#10;&#10;- this is a list item indented with spaces&#10;&#10; - this is an example list item indented with tabs&#10;&#10; - this is an example list item indented with spaces&#10;&#10;">
40 <outline text="Tabs and spaces" _note="- this is a list item indented with tabs&#10;&#10;- this is a list item indented with spaces&#10;&#10; - this is an example list item indented with tabs&#10;&#10; - this is an example list item indented with spaces&#10;&#10;">
41 </outline>
41 </outline>
42− <outline text="Fancy list markers" _note="(2) begins with 2&#10;(3) and now 3&#10;&#10; with a continuation&#10;&#10; iv. sublist with roman numerals, starting with 4&#10; v. more items&#10; (A) a subsublist&#10; (B) a subsublist&#10;&#10;Nesting:&#10;&#10;A. Upper Alpha&#10; I. Upper Roman.&#10; (6) Decimal start with 6&#10; c) Lower alpha with paren&#10;&#10;Autonumbering:&#10;&#10;1. Autonumber.&#10;2. More.&#10; 1. Nested.&#10;&#10;Should not be a list item:&#10;&#10;M.A. 2007&#10;&#10;B. Williams&#10;&#10;* * * * *">
42+ <outline text="Fancy list markers" _note="(2) begins with 2&#10;(3) and now 3&#10;&#10; with a continuation&#10;&#10; iv. sublist with roman numerals, starting with 4&#10; v. more items&#10; (A) a subsublist&#10; (B) a subsublist&#10;&#10;Nesting:&#10;&#10;A. Upper Alpha&#10; I. Upper Roman.&#10; (6) Decimal start with 6&#10; c) Lower alpha with paren&#10;&#10;Autonumbering:&#10;&#10;1. Autonumber.&#10;2. More.&#10; 1. Nested.&#10;&#10;Should not be a list item:&#10;&#10;M.A. 2007&#10;&#10;B. Williams&#10;&#10;------------------------------------------------------------------------">
43 </outline>
43 </outline>
44</outline>
44</outline>
45−<outline text="Definition Lists" _note="Tight using spaces:&#10;&#10;apple&#10;: red fruit&#10;orange&#10;: orange fruit&#10;banana&#10;: yellow fruit&#10;&#10;Tight using tabs:&#10;&#10;apple&#10;: red fruit&#10;orange&#10;: orange fruit&#10;banana&#10;: yellow fruit&#10;&#10;Loose:&#10;&#10;apple&#10;: red fruit&#10;&#10;orange&#10;: orange fruit&#10;&#10;banana&#10;: yellow fruit&#10;&#10;Multiple blocks with italics:&#10;&#10;*apple*&#10;: red fruit&#10;&#10; contains seeds, crisp, pleasant to taste&#10;&#10;*orange*&#10;: orange fruit&#10;&#10; { orange code block }&#10;&#10; &gt; orange block quote&#10;&#10;Multiple definitions, tight:&#10;&#10;apple&#10;: red fruit&#10;: computer&#10;orange&#10;: orange fruit&#10;: bank&#10;&#10;Multiple definitions, loose:&#10;&#10;apple&#10;: red fruit&#10;&#10;: computer&#10;&#10;orange&#10;: orange fruit&#10;&#10;: bank&#10;&#10;Blank line after term, indented marker, alternate markers:&#10;&#10;apple&#10;: red fruit&#10;&#10;: computer&#10;&#10;orange&#10;: orange fruit&#10;&#10; 1. sublist&#10; 2. sublist&#10;&#10;">
45+<outline text="Definition Lists" _note="Tight using spaces:&#10;&#10;apple&#10;: red fruit&#10;&#10;orange&#10;: orange fruit&#10;&#10;banana&#10;: yellow fruit&#10;&#10;Tight using tabs:&#10;&#10;apple&#10;: red fruit&#10;&#10;orange&#10;: orange fruit&#10;&#10;banana&#10;: yellow fruit&#10;&#10;Loose:&#10;&#10;apple&#10;&#10;: red fruit&#10;&#10;orange&#10;&#10;: orange fruit&#10;&#10;banana&#10;&#10;: yellow fruit&#10;&#10;Multiple blocks with italics:&#10;&#10;*apple*&#10;&#10;: red fruit&#10;&#10; contains seeds, crisp, pleasant to taste&#10;&#10;*orange*&#10;&#10;: orange fruit&#10;&#10; { orange code block }&#10;&#10; &gt; orange block quote&#10;&#10;Multiple definitions, tight:&#10;&#10;apple&#10;: red fruit&#10;: computer&#10;&#10;orange&#10;: orange fruit&#10;: bank&#10;&#10;Multiple definitions, loose:&#10;&#10;apple&#10;&#10;: red fruit&#10;&#10;: computer&#10;&#10;orange&#10;&#10;: orange fruit&#10;&#10;: bank&#10;&#10;Blank line after term, indented marker, alternate markers:&#10;&#10;apple&#10;&#10;: red fruit&#10;&#10;: computer&#10;&#10;orange&#10;&#10;: orange fruit&#10;&#10; 1. sublist&#10; 2. sublist&#10;&#10;">
46</outline>
46</outline>
47−<outline text="HTML Blocks" _note="Simple block on one line:&#10;&#10;&lt;div&gt;&#10;&#10;foo&#10;&#10;&lt;/div&gt;&#10;&#10;And nested without indentation:&#10;&#10;&lt;div&gt;&#10;&#10;&lt;div&gt;&#10;&#10;&lt;div&gt;&#10;&#10;foo&#10;&#10;&lt;/div&gt;&#10;&#10;&lt;/div&gt;&#10;&#10;&lt;div&gt;&#10;&#10;bar&#10;&#10;&lt;/div&gt;&#10;&#10;&lt;/div&gt;&#10;&#10;Interpreted markdown in a table:&#10;&#10;&lt;table&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;&#10;This is *emphasized*&#10;&lt;/td&gt;&#10;&lt;td&gt;&#10;And this is **strong**&#10;&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/table&gt;&#10;&lt;script type=&quot;text/javascript&quot;&gt;document.write('This *should not* be interpreted as markdown');&lt;/script&gt;&#10;Here’s a simple block:&#10;&#10;&lt;div&gt;&#10;&#10;foo&#10;&#10;&lt;/div&gt;&#10;&#10;This should be a code block, though:&#10;&#10; &lt;div&gt;&#10; foo&#10; &lt;/div&gt;&#10;&#10;As should this:&#10;&#10; &lt;div&gt;foo&lt;/div&gt;&#10;&#10;Now, nested:&#10;&#10;&lt;div&gt;&#10;&#10;&lt;div&gt;&#10;&#10;&lt;div&gt;&#10;&#10;foo&#10;&#10;&lt;/div&gt;&#10;&#10;&lt;/div&gt;&#10;&#10;&lt;/div&gt;&#10;&#10;This should just be an HTML comment:&#10;&#10;&lt;!-- Comment --&gt;&#10;Multiline:&#10;&#10;&lt;!--&#10;Blah&#10;Blah&#10;--&gt;&#10;&lt;!--&#10; This is another comment.&#10;--&gt;&#10;Code block:&#10;&#10; &lt;!-- Comment --&gt;&#10;&#10;Just plain comment, with trailing spaces on the line:&#10;&#10;&lt;!-- foo --&gt;&#10;Code:&#10;&#10; &lt;hr /&gt;&#10;&#10;Hr’s:&#10;&#10;&lt;hr&gt;&#10;&lt;hr /&gt;&#10;&lt;hr /&gt;&#10;&lt;hr&gt;&#10;&lt;hr /&gt;&#10;&lt;hr /&gt;&#10;&lt;hr class=&quot;foo&quot; id=&quot;bar&quot; /&gt;&#10;&lt;hr class=&quot;foo&quot; id=&quot;bar&quot; /&gt;&#10;&lt;hr class=&quot;foo&quot; id=&quot;bar&quot;&gt;&#10;&#10;* * * * *">
47+<outline text="HTML Blocks" _note="Simple block on one line:&#10;&#10;&lt;div&gt;&#10;&#10;foo&#10;&#10;&lt;/div&gt;&#10;&#10;And nested without indentation:&#10;&#10;&lt;div&gt;&#10;&#10;&lt;div&gt;&#10;&#10;&lt;div&gt;&#10;&#10;foo&#10;&#10;&lt;/div&gt;&#10;&#10;&lt;/div&gt;&#10;&#10;&lt;div&gt;&#10;&#10;bar&#10;&#10;&lt;/div&gt;&#10;&#10;&lt;/div&gt;&#10;&#10;Interpreted markdown in a table:&#10;&#10;&lt;table&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;&#10;This is *emphasized*&#10;&lt;/td&gt;&#10;&lt;td&gt;&#10;And this is **strong**&#10;&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/table&gt;&#10;&lt;script type=&quot;text/javascript&quot;&gt;document.write('This *should not* be interpreted as markdown');&lt;/script&gt;&#10;Here’s a simple block:&#10;&#10;&lt;div&gt;&#10;&#10;foo&#10;&#10;&lt;/div&gt;&#10;&#10;This should be a code block, though:&#10;&#10; &lt;div&gt;&#10; foo&#10; &lt;/div&gt;&#10;&#10;As should this:&#10;&#10; &lt;div&gt;foo&lt;/div&gt;&#10;&#10;Now, nested:&#10;&#10;&lt;div&gt;&#10;&#10;&lt;div&gt;&#10;&#10;&lt;div&gt;&#10;&#10;foo&#10;&#10;&lt;/div&gt;&#10;&#10;&lt;/div&gt;&#10;&#10;&lt;/div&gt;&#10;&#10;This should just be an HTML comment:&#10;&#10;&lt;!-- Comment --&gt;&#10;Multiline:&#10;&#10;&lt;!--&#10;Blah&#10;Blah&#10;--&gt;&#10;&lt;!--&#10; This is another comment.&#10;--&gt;&#10;Code block:&#10;&#10; &lt;!-- Comment --&gt;&#10;&#10;Just plain comment, with trailing spaces on the line:&#10;&#10;&lt;!-- foo --&gt;&#10;Code:&#10;&#10; &lt;hr /&gt;&#10;&#10;Hr’s:&#10;&#10;&lt;hr&gt;&#10;&lt;hr /&gt;&#10;&lt;hr /&gt;&#10;&lt;hr&gt;&#10;&lt;hr /&gt;&#10;&lt;hr /&gt;&#10;&lt;hr class=&quot;foo&quot; id=&quot;bar&quot; /&gt;&#10;&lt;hr class=&quot;foo&quot; id=&quot;bar&quot; /&gt;&#10;&lt;hr class=&quot;foo&quot; id=&quot;bar&quot;&gt;&#10;&#10;------------------------------------------------------------------------">
48</outline>
48</outline>
49−<outline text="Inline Markup" _note="This is *emphasized*, and so *is this*.&#10;&#10;This is **strong**, and so **is this**.&#10;&#10;An *[emphasized link](/url)*.&#10;&#10;***This is strong and em.***&#10;&#10;So is ***this*** word.&#10;&#10;***This is strong and em.***&#10;&#10;So is ***this*** word.&#10;&#10;This is code: `&gt;`, `$`, `\`, `\$`, `&lt;html&gt;`.&#10;&#10;~~This is *strikeout*.~~&#10;&#10;Superscripts: a^bc^d a^*hello*^ a^hello there^.&#10;&#10;Subscripts: H~2~O, H~23~O, H~many of them~O.&#10;&#10;These should not be superscripts or subscripts, because of the unescaped&#10;spaces: a\^b c\^d, a\~b c\~d.&#10;&#10;* * * * *">
49+<outline text="Inline Markup" _note="This is *emphasized*, and so *is this*.&#10;&#10;This is **strong**, and so **is this**.&#10;&#10;An *[emphasized link](/url)*.&#10;&#10;***This is strong and em.***&#10;&#10;So is ***this*** word.&#10;&#10;***This is strong and em.***&#10;&#10;So is ***this*** word.&#10;&#10;This is code: `&gt;`, `$`, `\`, `\$`, `&lt;html&gt;`.&#10;&#10;~~This is *strikeout*.~~&#10;&#10;Superscripts: a^bc^d a^*hello*^ a^hello there^.&#10;&#10;Subscripts: H~2~O, H~23~O, H~many of them~O.&#10;&#10;These should not be superscripts or subscripts, because of the unescaped&#10;spaces: a\^b c\^d, a\~b c\~d.&#10;&#10;------------------------------------------------------------------------">
50</outline>
50</outline>
51−<outline text="Smart quotes, ellipses, dashes" _note="“Hello,” said the spider. “‘Shelob’ is my name.”&#10;&#10;‘A’, ‘B’, and ‘C’ are letters.&#10;&#10;‘Oak,’ ‘elm,’ and ‘beech’ are names of trees. So is ‘pine.’&#10;&#10;‘He said, “I want to go.”’ Were you alive in the 70’s?&#10;&#10;Here is some quoted ‘`code`’ and a “[quoted&#10;link](http://example.com/?foo=1&amp;bar=2)”.&#10;&#10;Some dashes: one—two — three—four — five.&#10;&#10;Dashes between numbers: 5–7, 255–66, 1987–1999.&#10;&#10;Ellipses…and…and….&#10;&#10;* * * * *">
51+<outline text="Smart quotes, ellipses, dashes" _note="“Hello,” said the spider. “‘Shelob’ is my name.”&#10;&#10;‘A’, ‘B’, and ‘C’ are letters.&#10;&#10;‘Oak,’ ‘elm,’ and ‘beech’ are names of trees. So is ‘pine.’&#10;&#10;‘He said, “I want to go.”’ Were you alive in the 70’s?&#10;&#10;Here is some quoted ‘`code`’ and a “[quoted&#10;link](http://example.com/?foo=1&amp;bar=2)”.&#10;&#10;Some dashes: one—two — three—four — five.&#10;&#10;Dashes between numbers: 5–7, 255–66, 1987–1999.&#10;&#10;Ellipses…and…and….&#10;&#10;------------------------------------------------------------------------">
52</outline>
52</outline>
53−<outline text="LaTeX" _note="- \cite[22-23]{smith.1899}&#10;- $2+2=4$&#10;- $x \in y$&#10;- $\alpha \wedge \omega$&#10;- $223$&#10;- $p$-Tree&#10;- Here’s some display math:&#10; $$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$&#10;- Here’s one that has a line break in it:&#10; $\alpha + \omega \times x^2$.&#10;&#10;These shouldn’t be math:&#10;&#10;- To get the famous equation, write `$e = mc^2$`.&#10;- \$22,000 is a *lot* of money. So is \$34,000. (It worked if “lot” is&#10; emphasized.)&#10;- Shoes (\$20) and socks (\$5).&#10;- Escaped `$`: \$73 *this should be emphasized* 23\$.&#10;&#10;Here’s a LaTeX table:&#10;&#10;\begin{tabular}{|l|l|}\hline&#10;Animal &amp; Number \\ \hline&#10;Dog &amp; 2 \\&#10;Cat &amp; 1 \\ \hline&#10;\end{tabular}&#10;&#10;* * * * *">
53+<outline text="LaTeX" _note="- \cite[22-23]{smith.1899}&#10;- $2+2=4$&#10;- $x \in y$&#10;- $\alpha \wedge \omega$&#10;- $223$&#10;- $p$-Tree&#10;- Here’s some display math:&#10; $$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$&#10;- Here’s one that has a line break in it:&#10; $\alpha + \omega \times x^2$.&#10;&#10;These shouldn’t be math:&#10;&#10;- To get the famous equation, write `$e = mc^2$`.&#10;- \$22,000 is a *lot* of money. So is \$34,000. (It worked if “lot” is&#10; emphasized.)&#10;- Shoes (\$20) and socks (\$5).&#10;- Escaped `$`: \$73 *this should be emphasized* 23\$.&#10;&#10;Here’s a LaTeX table:&#10;&#10;\begin{tabular}{|l|l|}\hline&#10;Animal &amp; Number \\ \hline&#10;Dog &amp; 2 \\&#10;Cat &amp; 1 \\ \hline&#10;\end{tabular}&#10;&#10;------------------------------------------------------------------------">
54</outline>
54</outline>
55−<outline text="Special Characters" _note="Here is some unicode:&#10;&#10;- I hat: Î&#10;- o umlaut: ö&#10;- section: §&#10;- set membership: ∈&#10;- copyright: ©&#10;&#10;AT&amp;T has an ampersand in their name.&#10;&#10;AT&amp;T is another way to write it.&#10;&#10;This &amp; that.&#10;&#10;4 \&lt; 5.&#10;&#10;6 \&gt; 5.&#10;&#10;Backslash: \\&#10;&#10;Backtick: \`&#10;&#10;Asterisk: \*&#10;&#10;Underscore: \_&#10;&#10;Left brace: {&#10;&#10;Right brace: }&#10;&#10;Left bracket: [&#10;&#10;Right bracket: ]&#10;&#10;Left paren: (&#10;&#10;Right paren: )&#10;&#10;Greater-than: \&gt;&#10;&#10;Hash: \#&#10;&#10;Period: .&#10;&#10;Bang: !&#10;&#10;Plus: +&#10;&#10;Minus: -&#10;&#10;* * * * *">
55+<outline text="Special Characters" _note="Here is some unicode:&#10;&#10;- I hat: Î&#10;- o umlaut: ö&#10;- section: §&#10;- set membership: ∈&#10;- copyright: ©&#10;&#10;AT&amp;T has an ampersand in their name.&#10;&#10;AT&amp;T is another way to write it.&#10;&#10;This &amp; that.&#10;&#10;4 \&lt; 5.&#10;&#10;6 \&gt; 5.&#10;&#10;Backslash: \\&#10;&#10;Backtick: \`&#10;&#10;Asterisk: \*&#10;&#10;Underscore: \_&#10;&#10;Left brace: {&#10;&#10;Right brace: }&#10;&#10;Left bracket: [&#10;&#10;Right bracket: ]&#10;&#10;Left paren: (&#10;&#10;Right paren: )&#10;&#10;Greater-than: \&gt;&#10;&#10;Hash: \#&#10;&#10;Period: .&#10;&#10;Bang: !&#10;&#10;Plus: +&#10;&#10;Minus: -&#10;&#10;------------------------------------------------------------------------">
56</outline>
56</outline>
57<outline text="Links">
57<outline text="Links">
58 <outline text="Explicit" _note="Just a [URL](/url/).&#10;&#10;[URL and title](/url/ &quot;title&quot;).&#10;&#10;[URL and title](/url/ &quot;title preceded by two spaces&quot;).&#10;&#10;[URL and title](/url/ &quot;title preceded by a tab&quot;).&#10;&#10;[URL and title](/url/ &quot;title with &quot;quotes&quot; in it&quot;)&#10;&#10;[URL and title](/url/ &quot;title with single quotes&quot;)&#10;&#10;[with\_underscore](/url/with_underscore)&#10;&#10;[Email link](mailto:nobody@nowhere.net)&#10;&#10;[Empty]().&#10;">
58 <outline text="Explicit" _note="Just a [URL](/url/).&#10;&#10;[URL and title](/url/ &quot;title&quot;).&#10;&#10;[URL and title](/url/ &quot;title preceded by two spaces&quot;).&#10;&#10;[URL and title](/url/ &quot;title preceded by a tab&quot;).&#10;&#10;[URL and title](/url/ &quot;title with &quot;quotes&quot; in it&quot;)&#10;&#10;[URL and title](/url/ &quot;title with single quotes&quot;)&#10;&#10;[with\_underscore](/url/with_underscore)&#10;&#10;[Email link](mailto:nobody@nowhere.net)&#10;&#10;[Empty]().&#10;">
@@ -61,10 +61,10 @@
61 </outline>
61 </outline>
62 <outline text="With ampersands" _note="Here’s a [link with an ampersand in the&#10;URL](http://example.com/?foo=1&amp;bar=2).&#10;&#10;Here’s a link with an amersand in the link text:&#10;[AT&amp;T](http://att.com/ &quot;AT&amp;T&quot;).&#10;&#10;Here’s an [inline link](/script?foo=1&amp;bar=2).&#10;&#10;Here’s an [inline link in pointy braces](/script?foo=1&amp;bar=2).&#10;">
62 <outline text="With ampersands" _note="Here’s a [link with an ampersand in the&#10;URL](http://example.com/?foo=1&amp;bar=2).&#10;&#10;Here’s a link with an amersand in the link text:&#10;[AT&amp;T](http://att.com/ &quot;AT&amp;T&quot;).&#10;&#10;Here’s an [inline link](/script?foo=1&amp;bar=2).&#10;&#10;Here’s an [inline link in pointy braces](/script?foo=1&amp;bar=2).&#10;">
63 </outline>
63 </outline>
64− <outline text="Autolinks" _note="With an ampersand: &lt;http://example.com/?foo=1&amp;bar=2&gt;&#10;&#10;- In a list?&#10;- &lt;http://example.com/&gt;&#10;- It should.&#10;&#10;An e-mail address: &lt;nobody@nowhere.net&gt;&#10;&#10;&gt; Blockquoted: &lt;http://example.com/&gt;&#10;&#10;Auto-links should not occur here: `&lt;http://example.com/&gt;`&#10;&#10; or here: &lt;http://example.com/&gt;&#10;&#10;* * * * *">
64+ <outline text="Autolinks" _note="With an ampersand: &lt;http://example.com/?foo=1&amp;bar=2&gt;&#10;&#10;- In a list?&#10;- &lt;http://example.com/&gt;&#10;- It should.&#10;&#10;An e-mail address: &lt;nobody@nowhere.net&gt;&#10;&#10;&gt; Blockquoted: &lt;http://example.com/&gt;&#10;&#10;Auto-links should not occur here: `&lt;http://example.com/&gt;`&#10;&#10; or here: &lt;http://example.com/&gt;&#10;&#10;------------------------------------------------------------------------">
65 </outline>
65 </outline>
66</outline>
66</outline>
67−<outline text="Images" _note="From “Voyage dans la Lune” by Georges Melies (1902):&#10;&#10;![lalune](lalune.jpg &quot;Voyage dans la Lune&quot;)&#10;&#10;Here is a movie ![movie](movie.jpg) icon.&#10;&#10;* * * * *">
67+<outline text="Images" _note="From “Voyage dans la Lune” by Georges Melies (1902):&#10;&#10;![lalune](lalune.jpg &quot;Voyage dans la Lune&quot;)&#10;&#10;Here is a movie ![movie](movie.jpg) icon.&#10;&#10;------------------------------------------------------------------------">
68</outline>
68</outline>
69<outline text="Footnotes" _note="Here is a footnote reference,[^1] and another.[^2] This should *not* be&#10;a footnote reference, because it contains a space.[\^my note] Here is an&#10;inline note.[^3]&#10;&#10;&gt; Notes can go in quotes.[^4]&#10;&#10;1. And in list items.[^5]&#10;&#10;This paragraph should not be part of the note, as it is not indented.&#10;&#10;[^1]: Here is the footnote. It can go anywhere after the footnote&#10; reference. It need not be placed at the end of the document.&#10;&#10;[^2]: Here’s the long note. This one contains multiple blocks.&#10;&#10; Subsequent blocks are indented to show that they belong to the&#10; footnote (as with list items).&#10;&#10; { &lt;code&gt; }&#10;&#10; If you want, you can indent every line, but you can also be lazy and&#10; just indent the first line of each block.&#10;&#10;[^3]: This is *easier* to type. Inline notes may contain&#10; [links](http://google.com) and `]` verbatim characters, as well as&#10; [bracketed text].&#10;&#10;[^4]: In quote.&#10;&#10;[^5]: In list.&#10;">
69<outline text="Footnotes" _note="Here is a footnote reference,[^1] and another.[^2] This should *not* be&#10;a footnote reference, because it contains a space.[\^my note] Here is an&#10;inline note.[^3]&#10;&#10;&gt; Notes can go in quotes.[^4]&#10;&#10;1. And in list items.[^5]&#10;&#10;This paragraph should not be part of the note, as it is not indented.&#10;&#10;[^1]: Here is the footnote. It can go anywhere after the footnote&#10; reference. It need not be placed at the end of the document.&#10;&#10;[^2]: Here’s the long note. This one contains multiple blocks.&#10;&#10; Subsequent blocks are indented to show that they belong to the&#10; footnote (as with list items).&#10;&#10; { &lt;code&gt; }&#10;&#10; If you want, you can indent every line, but you can also be lazy and&#10; just indent the first line of each block.&#10;&#10;[^3]: This is *easier* to type. Inline notes may contain&#10; [links](http://google.com) and `]` verbatim characters, as well as&#10; [bracketed text].&#10;&#10;[^4]: In quote.&#10;&#10;[^5]: In list.&#10;">
70</outline>
70</outline>
tests/writer.plain+121−81
@@ -5,39 +5,43 @@ July 17, 2006
5This is a set of tests for pandoc. Most of them are adapted from John Gruber’s
5This is a set of tests for pandoc. Most of them are adapted from John Gruber’s
6markdown test suite.
6markdown test suite.
7
7
8−* * * * *
8+------------------------------------------------------------------------------
9+
10+
9
11
10Headers
12Headers
11−=======
13+
12
14
13Level 2 with an embedded link
15Level 2 with an embedded link
14−-----------------------------
15
16
16−Level 3 with emphasis
17+Level 3 with _emphasis_
17
18
18Level 4
19Level 4
19
20
20Level 5
21Level 5
21
22
23+
24+
22Level 1
25Level 1
23−=======
24
26
27+
25−Level 2 with emphasis
28+Level 2 with _emphasis_
26−---------------------
27
29
28Level 3
30Level 3
29
31
30with no blank line
32with no blank line
31
33
34+
32Level 2
35Level 2
33−-------
34
36
35with no blank line
37with no blank line
36
38
37−* * * * *
39+------------------------------------------------------------------------------
40+
41+
38
42
39Paragraphs
43Paragraphs
40−==========
44+
41
45
42Here’s a regular paragraph.
46Here’s a regular paragraph.
43
47
@@ -47,13 +51,15 @@ item.
47
51
48Here’s one with a bullet. * criminey.
52Here’s one with a bullet. * criminey.
49
53
50−There should be a hard line break
54+There should be a hard line break
51here.
55here.
52
56
53−* * * * *
57+------------------------------------------------------------------------------
58+
59+
54
60
55Block Quotes
61Block Quotes
56−============
62+
57
63
58E-mail style:
64E-mail style:
59
65
@@ -80,10 +86,12 @@ This should not be a block quote: 2 > 1.
80
86
81And a following paragraph.
87And a following paragraph.
82
88
83−* * * * *
89+------------------------------------------------------------------------------
90+
91+
84
92
85Code Blocks
93Code Blocks
86−===========
94+
87
95
88Code:
96Code:
89
97
@@ -101,13 +109,14 @@ And:
101
109
102 These should not be escaped: \$ \\ \> \[ \{
110 These should not be escaped: \$ \\ \> \[ \{
103
111
104−* * * * *
112+------------------------------------------------------------------------------
113+
114+
105
115
106Lists
116Lists
107−=====
117+
108
118
109Unordered
119Unordered
110−---------
111
120
112Asterisks tight:
121Asterisks tight:
113
122
@@ -151,8 +160,8 @@ Minuses loose:
151
160
152- Minus 3
161- Minus 3
153
162
163+
154Ordered
164Ordered
155−-------
156
165
157Tight:
166Tight:
158
167
@@ -192,8 +201,8 @@ Multiple paragraphs:
192
201
1933. Item 3.
2023. Item 3.
194
203
204+
195Nested
205Nested
196−------
197
206
198- Tab
207- Tab
199 - Tab
208 - Tab
@@ -221,8 +230,8 @@ Same thing but with paragraphs:
221
230
2223. Third
2313. Third
223
232
233+
224Tabs and spaces
234Tabs and spaces
225−---------------
226
235
227- this is a list item indented with tabs
236- this is a list item indented with tabs
228
237
@@ -232,8 +241,8 @@ Tabs and spaces
232
241
233 - this is an example list item indented with spaces
242 - this is an example list item indented with spaces
234
243
244+
235Fancy list markers
245Fancy list markers
236−------------------
237
246
238(2) begins with 2
247(2) begins with 2
239(3) and now 3
248(3) and now 3
@@ -264,17 +273,21 @@ M.A. 2007
264
273
265B. Williams
274B. Williams
266
275
267−* * * * *
276+------------------------------------------------------------------------------
277+
278+
268
279
269Definition Lists
280Definition Lists
270−================
281+
271
282
272Tight using spaces:
283Tight using spaces:
273
284
274apple
285apple
275 red fruit
286 red fruit
287+
276orange
288orange
277 orange fruit
289 orange fruit
290+
278banana
291banana
279 yellow fruit
292 yellow fruit
280
293
@@ -282,30 +295,37 @@ Tight using tabs:
282
295
283apple
296apple
284 red fruit
297 red fruit
298+
285orange
299orange
286 orange fruit
300 orange fruit
301+
287banana
302banana
288 yellow fruit
303 yellow fruit
289
304
290Loose:
305Loose:
291
306
292apple
307apple
308+
293 red fruit
309 red fruit
294
310
295orange
311orange
312+
296 orange fruit
313 orange fruit
297
314
298banana
315banana
316+
299 yellow fruit
317 yellow fruit
300
318
301Multiple blocks with italics:
319Multiple blocks with italics:
302
320
303−apple
321+_apple_
322+
304 red fruit
323 red fruit
305
324
306 contains seeds, crisp, pleasant to taste
325 contains seeds, crisp, pleasant to taste
307
326
308−orange
327+_orange_
328+
309 orange fruit
329 orange fruit
310
330
311 { orange code block }
331 { orange code block }
@@ -317,6 +337,7 @@ Multiple definitions, tight:
317apple
337apple
318 red fruit
338 red fruit
319 computer
339 computer
340+
320orange
341orange
321 orange fruit
342 orange fruit
322 bank
343 bank
@@ -324,11 +345,13 @@ orange
324Multiple definitions, loose:
345Multiple definitions, loose:
325
346
326apple
347apple
348+
327 red fruit
349 red fruit
328
350
329 computer
351 computer
330
352
331orange
353orange
354+
332 orange fruit
355 orange fruit
333
356
334 bank
357 bank
@@ -336,18 +359,22 @@ orange
336Blank line after term, indented marker, alternate markers:
359Blank line after term, indented marker, alternate markers:
337
360
338apple
361apple
362+
339 red fruit
363 red fruit
340
364
341 computer
365 computer
342
366
343orange
367orange
368+
344 orange fruit
369 orange fruit
345
370
346 1. sublist
371 1. sublist
347 2. sublist
372 2. sublist
348
373
374+
375+
349HTML Blocks
376HTML Blocks
350−===========
377+
351
378
352Simple block on one line:
379Simple block on one line:
353
380
@@ -361,8 +388,8 @@ bar
361
388
362Interpreted markdown in a table:
389Interpreted markdown in a table:
363
390
364−This is emphasized
391+This is _emphasized_
365−And this is strong
392+And this is STRONG
366Here’s a simple block:
393Here’s a simple block:
367
394
368foo
395foo
@@ -397,40 +424,44 @@ Code:
397
424
398Hr’s:
425Hr’s:
399
426
400−* * * * *
427+------------------------------------------------------------------------------
428+
429+
401
430
402Inline Markup
431Inline Markup
403−=============
404
432
405−This is emphasized, and so is this.
406
433
407−This is strong, and so is this.
434+This is _emphasized_, and so _is this_.
435+
436+This is STRONG, and so IS THIS.
408
437
409−An emphasized link.
438+An _emphasized link_.
410
439
411−This is strong and em.
440+_THIS IS STRONG AND EM._
412
441
413−So is this word.
442+So is _THIS_ word.
414
443
415−This is strong and em.
444+_THIS IS STRONG AND EM._
416
445
417−So is this word.
446+So is _THIS_ word.
418
447
419This is code: >, $, \, \$, <html>.
448This is code: >, $, \, \$, <html>.
420
449
421−This is strikeout.
450+~~This is _strikeout_.~~
422
451
423−Superscripts: abcd ahello ahello there.
452+Superscripts: a^bc^d a^_hello_^ a^hello there^.
424
453
425−Subscripts: H2O, H23O, Hmany of themO.
454+Subscripts: H~2~O, H~23~O, H~many of them~O.
426
455
427These should not be superscripts or subscripts, because of the unescaped
456These should not be superscripts or subscripts, because of the unescaped
428spaces: a^b c^d, a~b c~d.
457spaces: a^b c^d, a~b c~d.
429
458
430−* * * * *
459+------------------------------------------------------------------------------
460+
461+
431
462
432Smart quotes, ellipses, dashes
463Smart quotes, ellipses, dashes
433−==============================
464+
434
465
435“Hello,” said the spider. “‘Shelob’ is my name.”
466“Hello,” said the spider. “‘Shelob’ is my name.”
436
467
@@ -448,35 +479,39 @@ Dashes between numbers: 5–7, 255–66, 1987–1999.
448
479
449Ellipses…and…and….
480Ellipses…and…and….
450
481
451−* * * * *
482+------------------------------------------------------------------------------
483+
484+
452
485
453LaTeX
486LaTeX
454−=====
455
487
456−-
488+
489+- \cite[22-23]{smith.1899}
457−- 2+2=4
490+- 2 + 2 = 4
458−- x \in y
491+- x ∈ y
459−- \alpha \wedge \omega
492+- α ∧ ω
460- 223
493- 223
461- p-Tree
494- p-Tree
462- Here’s some display math:
495- Here’s some display math:
463− \frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}
496+ $$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$
464−- Here’s one that has a line break in it: \alpha + \omega \times x^2.
497+- Here’s one that has a line break in it: α + ω × x^2^.
465
498
466These shouldn’t be math:
499These shouldn’t be math:
467
500
468- To get the famous equation, write $e = mc^2$.
501- To get the famous equation, write $e = mc^2$.
469−- $22,000 is a lot of money. So is $34,000. (It worked if “lot” is
502+- $22,000 is a _lot_ of money. So is $34,000. (It worked if “lot” is
470 emphasized.)
503 emphasized.)
471- Shoes ($20) and socks ($5).
504- Shoes ($20) and socks ($5).
472−- Escaped $: $73 this should be emphasized 23$.
505+- Escaped $: $73 _this should be emphasized_ 23$.
473
506
474Here’s a LaTeX table:
507Here’s a LaTeX table:
475
508
476−* * * * *
509+------------------------------------------------------------------------------
510+
511+
477
512
478Special Characters
513Special Characters
479−==================
514+
480
515
481Here is some unicode:
516Here is some unicode:
482
517
@@ -528,13 +563,14 @@ Plus: +
528
563
529Minus: -
564Minus: -
530
565
531−* * * * *
566+------------------------------------------------------------------------------
567+
568+
532
569
533Links
570Links
534−=====
571+
535
572
536Explicit
573Explicit
537−--------
538
574
539Just a URL.
575Just a URL.
540
576
@@ -554,8 +590,8 @@ Email link
554
590
555Empty.
591Empty.
556
592
593+
557Reference
594Reference
558−---------
559
595
560Foo bar.
596Foo bar.
561
597
@@ -581,8 +617,8 @@ Foo bar.
581
617
582Foo biz.
618Foo biz.
583
619
620+
584With ampersands
621With ampersands
585−---------------
586
622
587Here’s a link with an ampersand in the URL.
623Here’s a link with an ampersand in the URL.
588
624
@@ -592,8 +628,8 @@ Here’s an inline link.
592
628
593Here’s an inline link in pointy braces.
629Here’s an inline link in pointy braces.
594
630
631+
595Autolinks
632Autolinks
596−---------
597
633
598With an ampersand: http://example.com/?foo=1&bar=2
634With an ampersand: http://example.com/?foo=1&bar=2
599
635
@@ -609,10 +645,12 @@ Auto-links should not occur here: <http://example.com/>
609
645
610 or here: <http://example.com/>
646 or here: <http://example.com/>
611
647
612−* * * * *
648+------------------------------------------------------------------------------
649+
650+
613
651
614Images
652Images
615−======
653+
616
654
617From “Voyage dans la Lune” by Georges Melies (1902):
655From “Voyage dans la Lune” by Georges Melies (1902):
618
656
@@ -620,37 +658,39 @@ From “Voyage dans la Lune” by Georges Melies (1902):
620
658
621Here is a movie [movie] icon.
659Here is a movie [movie] icon.
622
660
623−* * * * *
661+------------------------------------------------------------------------------
662+
663+
624
664
625Footnotes
665Footnotes
626−=========
627
666
667+
628−Here is a footnote reference,[^1] and another.[^2] This should not be a
668+Here is a footnote reference,[1] and another.[2] This should _not_ be a
629footnote reference, because it contains a space.[^my note] Here is an inline
669footnote reference, because it contains a space.[^my note] Here is an inline
630−note.[^3]
670+note.[3]
631
671
632− Notes can go in quotes.[^4]
672+ Notes can go in quotes.[4]
633
673
634−1. And in list items.[^5]
674+1. And in list items.[5]
635
675
636This paragraph should not be part of the note, as it is not indented.
676This paragraph should not be part of the note, as it is not indented.
637
677
638−[^1]: Here is the footnote. It can go anywhere after the footnote reference.
678+[1] Here is the footnote. It can go anywhere after the footnote reference. It
639− It need not be placed at the end of the document.
679+need not be placed at the end of the document.
640
680
641−[^2]: Here’s the long note. This one contains multiple blocks.
681+[2] Here’s the long note. This one contains multiple blocks.
642
682
643− Subsequent blocks are indented to show that they belong to the footnote
683+Subsequent blocks are indented to show that they belong to the footnote (as
644− (as with list items).
684+with list items).
645
685
646− { <code> }
686+ { <code> }
647
687
648− If you want, you can indent every line, but you can also be lazy and just
688+If you want, you can indent every line, but you can also be lazy and just
649− indent the first line of each block.
689+indent the first line of each block.
650
690
651−[^3]: This is easier to type. Inline notes may contain links and ] verbatim
691+[3] This is _easier_ to type. Inline notes may contain links and ] verbatim
652− characters, as well as [bracketed text].
692+characters, as well as [bracketed text].
653
693
654−[^4]: In quote.
694+[4] In quote.
655
695
656−[^5]: In list.
696+[5] In list.