diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-06-03 09:47:08 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-06-03 09:51:19 -0700 |
commit | 928681ca049e769bd32c195c6102db5506e7f6fa (patch) | |
tree | 87ea484f7779dd52431bfbc9eb65ca7faeab52c5 | |
parent | 7db3d9ab04cfa9b2d4c4f11112acfde15577958f (diff) | |
download | pandoc-928681ca049e769bd32c195c6102db5506e7f6fa.tar.gz |
Avoid unwanted interpretation of def list term as other kind of block,
e.g. ordered list item, in Markdown writer.
Closes #554.
-rw-r--r-- | src/Text/Pandoc/Writers/Markdown.hs | 8 | ||||
-rw-r--r-- | test/command/5543.md | 8 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index 85d9e85e1..50fba2dba 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -783,7 +783,7 @@ definitionListItemToMarkdown :: PandocMonad m -> ([Inline],[[Block]]) -> MD m Doc definitionListItemToMarkdown opts (label, defs) = do - labelText <- inlineListToMarkdown opts label + labelText <- blockToMarkdown opts (Plain label) defs' <- mapM (mapM (blockToMarkdown opts)) defs if isEnabled Ext_definition_lists opts then do @@ -804,10 +804,10 @@ definitionListItemToMarkdown opts (label, defs) = do let isTight = case defs of ((Plain _ : _): _) -> True _ -> False - return $ blankline <> nowrap labelText <> - (if isTight then cr else blankline) <> contents <> blankline + return $ blankline <> nowrap labelText $$ + (if isTight then empty else blankline) <> contents <> blankline else do - return $ nowrap labelText <> text " " <> cr <> + return $ nowrap (chomp labelText <> text " " <> cr) <> vsep (map vsep defs') <> blankline -- | Convert list of Pandoc block elements to markdown. diff --git a/test/command/5543.md b/test/command/5543.md new file mode 100644 index 000000000..6cae49e66 --- /dev/null +++ b/test/command/5543.md @@ -0,0 +1,8 @@ +``` +% pandoc -t markdown +1\. item +: description +^D +1\. item +: description +``` |