aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Writers/Markdown.hs47
-rw-r--r--tests/writer.markdown40
-rw-r--r--tests/writer.opml26
-rw-r--r--tests/writer.plain202
4 files changed, 187 insertions, 128 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
index 41bec8b87..ab87988b8 100644
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -37,7 +37,7 @@ import Text.Pandoc.Templates (renderTemplate')
import Text.Pandoc.Shared
import Text.Pandoc.Writers.Shared
import Text.Pandoc.Options
-import Text.Pandoc.Parsing hiding (blankline, char, space)
+import Text.Pandoc.Parsing hiding (blankline, blanklines, char, space)
import Data.List ( group, isPrefixOf, find, intersperse, transpose, sortBy )
import Data.Char ( isSpace, isPunctuation, toUpper )
import Data.Ord ( comparing )
@@ -79,6 +79,9 @@ writePlain opts document =
writerExtensions = Set.delete Ext_escaped_line_breaks $
Set.delete Ext_pipe_tables $
Set.delete Ext_raw_html $
+ Set.delete Ext_footnotes $
+ Set.delete Ext_tex_math_dollars $
+ Set.delete Ext_citations $
writerExtensions opts }
document) def{ stPlain = True }
@@ -171,7 +174,7 @@ pandocToMarkdown opts (Pandoc meta blocks) = do
then tableOfContents opts headerBlocks
else empty
-- Strip off final 'references' header if markdown citations enabled
- let blocks' = if not isPlain && isEnabled Ext_citations opts
+ let blocks' = if isEnabled Ext_citations opts
then case reverse blocks of
(Div (_,["references"],_) _):xs -> reverse xs
_ -> blocks
@@ -355,11 +358,11 @@ blockToMarkdown opts (Header level attr inlines) = do
let setext = writerSetextHeaders opts
return $ nowrap
$ case level of
- 1 | plain -> blankline <> text "\n\n" <> contents <> blankline <> text "\n"
+ 1 | plain -> blanklines 3 <> contents <> blanklines 2
| setext ->
contents <> attr' <> cr <> text (replicate (offset contents) '=') <>
blankline
- 2 | plain -> blankline <> text "\n" <> contents <> blankline
+ 2 | plain -> blanklines 2 <> contents <> blankline
| setext ->
contents <> attr' <> cr <> text (replicate (offset contents) '-') <>
blankline
@@ -695,23 +698,15 @@ inlineToMarkdown opts (Strikeout lst) = do
then "~~" <> contents <> "~~"
else "<s>" <> contents <> "</s>"
inlineToMarkdown opts (Superscript lst) = do
- plain <- gets stPlain
- if plain
- then inlineListToMarkdown opts lst
- else do
- contents <- inlineListToMarkdown opts $ walk escapeSpaces lst
- return $ if isEnabled Ext_superscript opts
- then "^" <> contents <> "^"
- else "<sup>" <> contents <> "</sup>"
+ contents <- inlineListToMarkdown opts $ walk escapeSpaces lst
+ return $ if isEnabled Ext_superscript opts
+ then "^" <> contents <> "^"
+ else "<sup>" <> contents <> "</sup>"
inlineToMarkdown opts (Subscript lst) = do
- plain <- gets stPlain
- if plain
- then inlineListToMarkdown opts lst
- else do
- contents <- inlineListToMarkdown opts $ walk escapeSpaces lst
- return $ if isEnabled Ext_subscript opts
- then "~" <> contents <> "~"
- else "<sub>" <> contents <> "</sub>"
+ contents <- inlineListToMarkdown opts $ walk escapeSpaces lst
+ return $ if isEnabled Ext_subscript opts
+ then "~" <> contents <> "~"
+ else "<sub>" <> contents <> "</sub>"
inlineToMarkdown opts (SmallCaps lst) = do
plain <- gets stPlain
if plain
@@ -753,7 +748,11 @@ inlineToMarkdown opts (Math InlineMath str)
return $ "\\(" <> text str <> "\\)"
| isEnabled Ext_tex_math_double_backslash opts =
return $ "\\\\(" <> text str <> "\\\\)"
- | otherwise = inlineListToMarkdown opts $ texMathToInlines InlineMath str
+ | otherwise = do
+ plain <- gets stPlain
+ inlineListToMarkdown opts $
+ (if plain then makeMathPlainer else id) $
+ texMathToInlines InlineMath str
inlineToMarkdown opts (Math DisplayMath str)
| isEnabled Ext_tex_math_dollars opts =
return $ "$$" <> text str <> "$$"
@@ -853,3 +852,9 @@ inlineToMarkdown opts (Note contents) = do
if isEnabled Ext_footnotes opts
then return $ "[^" <> ref <> "]"
else return $ "[" <> ref <> "]"
+
+makeMathPlainer :: [Inline] -> [Inline]
+makeMathPlainer = walk go
+ where
+ go (Emph xs) = Span nullAttr xs
+ go x = x
diff --git a/tests/writer.markdown b/tests/writer.markdown
index 9974d27e0..ad97b15ef 100644
--- a/tests/writer.markdown
+++ b/tests/writer.markdown
@@ -9,7 +9,7 @@ title: Pandoc Test Suite
This is a set of tests for pandoc. Most of them are adapted from John Gruber’s
markdown test suite.
-* * * * *
+------------------------------------------------------------------------------
Headers
=======
@@ -38,7 +38,7 @@ Level 2
with no blank line
-* * * * *
+------------------------------------------------------------------------------
Paragraphs
==========
@@ -54,7 +54,7 @@ Here’s one with a bullet. \* criminey.
There should be a hard line break\
here.
-* * * * *
+------------------------------------------------------------------------------
Block Quotes
============
@@ -84,7 +84,7 @@ This should not be a block quote: 2 \> 1.
And a following paragraph.
-* * * * *
+------------------------------------------------------------------------------
Code Blocks
===========
@@ -105,7 +105,7 @@ And:
These should not be escaped: \$ \\ \> \[ \{
-* * * * *
+------------------------------------------------------------------------------
Lists
=====
@@ -268,7 +268,7 @@ M.A. 2007
B. Williams
-* * * * *
+------------------------------------------------------------------------------
Definition Lists
================
@@ -277,8 +277,10 @@ Tight using spaces:
apple
: red fruit
+
orange
: orange fruit
+
banana
: yellow fruit
@@ -286,30 +288,37 @@ Tight using tabs:
apple
: red fruit
+
orange
: orange fruit
+
banana
: yellow fruit
Loose:
apple
+
: red fruit
orange
+
: orange fruit
banana
+
: yellow fruit
Multiple blocks with italics:
*apple*
+
: red fruit
contains seeds, crisp, pleasant to taste
*orange*
+
: orange fruit
{ orange code block }
@@ -321,6 +330,7 @@ Multiple definitions, tight:
apple
: red fruit
: computer
+
orange
: orange fruit
: bank
@@ -328,11 +338,13 @@ orange
Multiple definitions, loose:
apple
+
: red fruit
: computer
orange
+
: orange fruit
: bank
@@ -340,11 +352,13 @@ orange
Blank line after term, indented marker, alternate markers:
apple
+
: red fruit
: computer
orange
+
: orange fruit
1. sublist
@@ -465,7 +479,7 @@ Hr’s:
<hr class="foo" id="bar" />
<hr class="foo" id="bar">
-* * * * *
+------------------------------------------------------------------------------
Inline Markup
=============
@@ -495,7 +509,7 @@ Subscripts: H~2~O, H~23~O, H~many of them~O.
These should not be superscripts or subscripts, because of the unescaped
spaces: a\^b c\^d, a\~b c\~d.
-* * * * *
+------------------------------------------------------------------------------
Smart quotes, ellipses, dashes
==============================
@@ -517,7 +531,7 @@ Dashes between numbers: 5–7, 255–66, 1987–1999.
Ellipses…and…and….
-* * * * *
+------------------------------------------------------------------------------
LaTeX
=====
@@ -548,7 +562,7 @@ Dog & 2 \\
Cat & 1 \\ \hline
\end{tabular}
-* * * * *
+------------------------------------------------------------------------------
Special Characters
==================
@@ -603,7 +617,7 @@ Plus: +
Minus: -
-* * * * *
+------------------------------------------------------------------------------
Links
=====
@@ -685,7 +699,7 @@ Auto-links should not occur here: `<http://example.com/>`
or here: <http://example.com/>
-* * * * *
+------------------------------------------------------------------------------
Images
======
@@ -696,7 +710,7 @@ From “Voyage dans la Lune” by Georges Melies (1902):
Here is a movie ![movie](movie.jpg) icon.
-* * * * *
+------------------------------------------------------------------------------
Footnotes
=========
diff --git a/tests/writer.opml b/tests/writer.opml
index 7c7ff01c9..54be4b671 100644
--- a/tests/writer.opml
+++ b/tests/writer.opml
@@ -21,14 +21,14 @@
<outline text="Level 3" _note="with no blank line&#10;">
</outline>
</outline>
- <outline text="Level 2" _note="with no blank line&#10;&#10;* * * * *">
+ <outline text="Level 2" _note="with no blank line&#10;&#10;------------------------------------------------------------------------">
</outline>
</outline>
-<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;* * * * *">
+<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;------------------------------------------------------------------------">
</outline>
-<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;* * * * *">
+<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;------------------------------------------------------------------------">
</outline>
-<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;* * * * *">
+<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;------------------------------------------------------------------------">
</outline>
<outline text="Lists">
<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 @@
</outline>
<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;">
</outline>
- <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;* * * * *">
+ <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;------------------------------------------------------------------------">
</outline>
</outline>
-<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;">
+<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;">
</outline>
-<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;* * * * *">
+<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;------------------------------------------------------------------------">
</outline>
-<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;* * * * *">
+<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;------------------------------------------------------------------------">
</outline>
-<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;* * * * *">
+<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;------------------------------------------------------------------------">
</outline>
-<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;* * * * *">
+<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;------------------------------------------------------------------------">
</outline>
-<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;* * * * *">
+<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;------------------------------------------------------------------------">
</outline>
<outline text="Links">
<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 @@
</outline>
<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;">
</outline>
- <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;* * * * *">
+ <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;------------------------------------------------------------------------">
</outline>
</outline>
-<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;* * * * *">
+<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;------------------------------------------------------------------------">
</outline>
<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;">
</outline>
diff --git a/tests/writer.plain b/tests/writer.plain
index 60e7bb329..bd1a06998 100644
--- a/tests/writer.plain
+++ b/tests/writer.plain
@@ -5,39 +5,43 @@ July 17, 2006
This is a set of tests for pandoc. Most of them are adapted from John Gruber’s
markdown test suite.
-* * * * *
+------------------------------------------------------------------------------
+
+
Headers
-=======
+
Level 2 with an embedded link
------------------------------
-Level 3 with emphasis
+Level 3 with _emphasis_
Level 4
Level 5
+
+
Level 1
-=======
-Level 2 with emphasis
----------------------
+
+Level 2 with _emphasis_
Level 3
with no blank line
+
Level 2
--------
with no blank line
-* * * * *
+------------------------------------------------------------------------------
+
+
Paragraphs
-==========
+
Here’s a regular paragraph.
@@ -47,13 +51,15 @@ item.
Here’s one with a bullet. * criminey.
-There should be a hard line break
+There should be a hard line break
here.
-* * * * *
+------------------------------------------------------------------------------
+
+
Block Quotes
-============
+
E-mail style:
@@ -80,10 +86,12 @@ This should not be a block quote: 2 > 1.
And a following paragraph.
-* * * * *
+------------------------------------------------------------------------------
+
+
Code Blocks
-===========
+
Code:
@@ -101,13 +109,14 @@ And:
These should not be escaped: \$ \\ \> \[ \{
-* * * * *
+------------------------------------------------------------------------------
+
+
Lists
-=====
+
Unordered
----------
Asterisks tight:
@@ -151,8 +160,8 @@ Minuses loose:
- Minus 3
+
Ordered
--------
Tight:
@@ -192,8 +201,8 @@ Multiple paragraphs:
3. Item 3.
+
Nested
-------
- Tab
- Tab
@@ -221,8 +230,8 @@ Same thing but with paragraphs:
3. Third
+
Tabs and spaces
----------------
- this is a list item indented with tabs
@@ -232,8 +241,8 @@ Tabs and spaces
- this is an example list item indented with spaces
+
Fancy list markers
-------------------
(2) begins with 2
(3) and now 3
@@ -264,17 +273,21 @@ M.A. 2007
B. Williams
-* * * * *
+------------------------------------------------------------------------------
+
+
Definition Lists
-================
+
Tight using spaces:
apple
red fruit
+
orange
orange fruit
+
banana
yellow fruit
@@ -282,30 +295,37 @@ Tight using tabs:
apple
red fruit
+
orange
orange fruit
+
banana
yellow fruit
Loose:
apple
+
red fruit
orange
+
orange fruit
banana
+
yellow fruit
Multiple blocks with italics:
-apple
+_apple_
+
red fruit
contains seeds, crisp, pleasant to taste
-orange
+_orange_
+
orange fruit
{ orange code block }
@@ -317,6 +337,7 @@ Multiple definitions, tight:
apple
red fruit
computer
+
orange
orange fruit
bank
@@ -324,11 +345,13 @@ orange
Multiple definitions, loose:
apple
+
red fruit
computer
orange
+
orange fruit
bank
@@ -336,18 +359,22 @@ orange
Blank line after term, indented marker, alternate markers:
apple
+
red fruit
computer
orange
+
orange fruit
1. sublist
2. sublist
+
+
HTML Blocks
-===========
+
Simple block on one line:
@@ -361,8 +388,8 @@ bar
Interpreted markdown in a table:
-This is emphasized
-And this is strong
+This is _emphasized_
+And this is STRONG
Here’s a simple block:
foo
@@ -397,40 +424,44 @@ Code:
Hr’s:
-* * * * *
+------------------------------------------------------------------------------
+
+
Inline Markup
-=============
-This is emphasized, and so is this.
-This is strong, and so is this.
+This is _emphasized_, and so _is this_.
+
+This is STRONG, and so IS THIS.
-An emphasized link.
+An _emphasized link_.
-This is strong and em.
+_THIS IS STRONG AND EM._
-So is this word.
+So is _THIS_ word.
-This is strong and em.
+_THIS IS STRONG AND EM._
-So is this word.
+So is _THIS_ word.
This is code: >, $, \, \$, <html>.
-This is strikeout.
+~~This is _strikeout_.~~
-Superscripts: abcd ahello ahello there.
+Superscripts: a^bc^d a^_hello_^ a^hello there^.
-Subscripts: H2O, H23O, Hmany of themO.
+Subscripts: H~2~O, H~23~O, H~many of them~O.
These should not be superscripts or subscripts, because of the unescaped
spaces: a^b c^d, a~b c~d.
-* * * * *
+------------------------------------------------------------------------------
+
+
Smart quotes, ellipses, dashes
-==============================
+
“Hello,” said the spider. “‘Shelob’ is my name.”
@@ -448,35 +479,39 @@ Dashes between numbers: 5–7, 255–66, 1987–1999.
Ellipses…and…and….
-* * * * *
+------------------------------------------------------------------------------
+
+
LaTeX
-=====
--
-- 2+2=4
-- x \in y
-- \alpha \wedge \omega
+
+- \cite[22-23]{smith.1899}
+- 2 + 2 = 4
+- x ∈ y
+- α ∧ ω
- 223
- p-Tree
- Here’s some display math:
- \frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}
-- Here’s one that has a line break in it: \alpha + \omega \times x^2.
+ $$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$
+- Here’s one that has a line break in it: α + ω × x^2^.
These shouldn’t be math:
- To get the famous equation, write $e = mc^2$.
-- $22,000 is a lot of money. So is $34,000. (It worked if “lot” is
+- $22,000 is a _lot_ of money. So is $34,000. (It worked if “lot” is
emphasized.)
- Shoes ($20) and socks ($5).
-- Escaped $: $73 this should be emphasized 23$.
+- Escaped $: $73 _this should be emphasized_ 23$.
Here’s a LaTeX table:
-* * * * *
+------------------------------------------------------------------------------
+
+
Special Characters
-==================
+
Here is some unicode:
@@ -528,13 +563,14 @@ Plus: +
Minus: -
-* * * * *
+------------------------------------------------------------------------------
+
+
Links
-=====
+
Explicit
---------
Just a URL.
@@ -554,8 +590,8 @@ Email link
Empty.
+
Reference
----------
Foo bar.
@@ -581,8 +617,8 @@ Foo bar.
Foo biz.
+
With ampersands
----------------
Here’s a link with an ampersand in the URL.
@@ -592,8 +628,8 @@ Here’s an inline link.
Here’s an inline link in pointy braces.
+
Autolinks
----------
With an ampersand: http://example.com/?foo=1&bar=2
@@ -609,10 +645,12 @@ Auto-links should not occur here: <http://example.com/>
or here: <http://example.com/>
-* * * * *
+------------------------------------------------------------------------------
+
+
Images
-======
+
From “Voyage dans la Lune” by Georges Melies (1902):
@@ -620,37 +658,39 @@ From “Voyage dans la Lune” by Georges Melies (1902):
Here is a movie [movie] icon.
-* * * * *
+------------------------------------------------------------------------------
+
+
Footnotes
-=========
-Here is a footnote reference,[^1] and another.[^2] This should not be a
+
+Here is a footnote reference,[1] and another.[2] This should _not_ be a
footnote reference, because it contains a space.[^my note] Here is an inline
-note.[^3]
+note.[3]
- Notes can go in quotes.[^4]
+ Notes can go in quotes.[4]
-1. And in list items.[^5]
+1. And in list items.[5]
This paragraph should not be part of the note, as it is not indented.
-[^1]: Here is the footnote. It can go anywhere after the footnote reference.
- It need not be placed at the end of the document.
+[1] Here is the footnote. It can go anywhere after the footnote reference. It
+need not be placed at the end of the document.
-[^2]: Here’s the long note. This one contains multiple blocks.
+[2] Here’s the long note. This one contains multiple blocks.
- Subsequent blocks are indented to show that they belong to the footnote
- (as with list items).
+Subsequent blocks are indented to show that they belong to the footnote (as
+with list items).
- { <code> }
+ { <code> }
- If you want, you can indent every line, but you can also be lazy and just
- indent the first line of each block.
+If you want, you can indent every line, but you can also be lazy and just
+indent the first line of each block.
-[^3]: This is easier to type. Inline notes may contain links and ] verbatim
- characters, as well as [bracketed text].
+[3] This is _easier_ to type. Inline notes may contain links and ] verbatim
+characters, as well as [bracketed text].
-[^4]: In quote.
+[4] In quote.
-[^5]: In list.
+[5] In list.