Avoid unwanted interpretation of def list term as other kind of block,

e.g. ordered list item, in Markdown writer.

Closes #554.
This commit is contained in:
John MacFarlane 2019-06-03 09:47:08 -07:00
parent 7db3d9ab04
commit 928681ca04
2 changed files with 12 additions and 4 deletions

View file

@ -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.

8
test/command/5543.md Normal file
View file

@ -0,0 +1,8 @@
```
% pandoc -t markdown
1\. item
: description
^D
1\. item
: description
```