Commonmark writer: fix handling of SoftBreak with hard_line_breaks.

This should be rendered as a space.
Closes #5195.
This commit is contained in:
John MacFarlane 2019-01-02 10:31:13 -08:00
parent 1bbbd5fad3
commit ea8af33dab
2 changed files with 8 additions and 1 deletions

View file

@ -247,7 +247,7 @@ inlineToNodes opts (Str s) = stringToNodes opts s'
inlineToNodes _ Space = (node (TEXT (T.pack " ")) [] :)
inlineToNodes _ LineBreak = (node LINEBREAK [] :)
inlineToNodes opts SoftBreak
| isEnabled Ext_hard_line_breaks opts = (node LINEBREAK [] :)
| isEnabled Ext_hard_line_breaks opts = (node (TEXT " ") [] :)
| writerWrapText opts == WrapNone = (node (TEXT " ") [] :)
| otherwise = (node SOFTBREAK [] :)
inlineToNodes opts (Emph xs) = (node EMPH (inlinesToNodes opts xs) :)

7
test/command/5195.md Normal file
View file

@ -0,0 +1,7 @@
```
% pandoc -f markdown_strict -t gfm+hard_line_breaks
Hello
there
^D
Hello there
```