diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2012-05-16 13:07:58 -0700 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2012-05-16 13:07:58 -0700 |
commit | 4991852edbb1ad286518ca0d58c4b1082587969f (patch) | |
tree | 914488424c17b155975343d3047576a100621ae9 | |
parent | 4e35c67c23875dc76a9a1409597b4c40f7834a70 (diff) | |
download | pandoc-4991852edbb1ad286518ca0d58c4b1082587969f.tar.gz |
Markdown writer: Improved definition lists.
* Use `:` form instead of `~`, for better compatibility with other
markdown implementations.
* Don't wrap the term, because it breaks definition lists.
-rw-r--r-- | src/Text/Pandoc/Writers/Markdown.hs | 4 | ||||
-rw-r--r-- | tests/writer.markdown | 44 |
2 files changed, 24 insertions, 24 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index 3ec94af9d..a95c0ba7b 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -355,13 +355,13 @@ definitionListItemToMarkdown opts (label, defs) = do labelText <- inlineListToMarkdown opts label let tabStop = writerTabStop opts st <- get - let leader = if stPlain st then " " else " ~" + let leader = if stPlain st then " " else ": " let sps = case writerTabStop opts - 3 of n | n > 0 -> text $ replicate n ' ' _ -> text " " defs' <- mapM (mapM (blockToMarkdown opts)) defs let contents = vcat $ map (\d -> hang tabStop (leader <> sps) $ vcat d <> cr) defs' - return $ labelText <> cr <> contents <> cr + return $ nowrap labelText <> cr <> contents <> cr -- | Convert list of Pandoc block elements to markdown. blockListToMarkdown :: WriterOptions -- ^ Options diff --git a/tests/writer.markdown b/tests/writer.markdown index 14fc3a434..3d0fb765f 100644 --- a/tests/writer.markdown +++ b/tests/writer.markdown @@ -272,41 +272,41 @@ Definition Lists Tight using spaces: apple - ~ red fruit +: red fruit orange - ~ orange fruit +: orange fruit banana - ~ yellow fruit +: yellow fruit Tight using tabs: apple - ~ red fruit +: red fruit orange - ~ orange fruit +: orange fruit banana - ~ yellow fruit +: yellow fruit Loose: apple - ~ red fruit +: red fruit orange - ~ orange fruit +: orange fruit banana - ~ yellow fruit +: yellow fruit Multiple blocks with italics: *apple* - ~ red fruit +: red fruit contains seeds, crisp, pleasant to taste *orange* - ~ orange fruit +: orange fruit { orange code block } @@ -315,33 +315,33 @@ Multiple blocks with italics: Multiple definitions, tight: apple - ~ red fruit - ~ computer +: red fruit +: computer orange - ~ orange fruit - ~ bank +: orange fruit +: bank Multiple definitions, loose: apple - ~ red fruit +: red fruit - ~ computer +: computer orange - ~ orange fruit +: orange fruit - ~ bank +: bank Blank line after term, indented marker, alternate markers: apple - ~ red fruit +: red fruit - ~ computer +: computer orange - ~ orange fruit +: orange fruit 1. sublist 2. sublist |