From ea8af33dab2ba5abba12c61ada7e62f9752cb973 Mon Sep 17 00:00:00 2001 From: John MacFarlane <jgm@berkeley.edu> Date: Wed, 2 Jan 2019 10:31:13 -0800 Subject: [PATCH] Commonmark writer: fix handling of SoftBreak with `hard_line_breaks`. This should be rendered as a space. Closes #5195. --- src/Text/Pandoc/Writers/CommonMark.hs | 2 +- test/command/5195.md | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 test/command/5195.md diff --git a/src/Text/Pandoc/Writers/CommonMark.hs b/src/Text/Pandoc/Writers/CommonMark.hs index c007f7734..6299b0263 100644 --- a/src/Text/Pandoc/Writers/CommonMark.hs +++ b/src/Text/Pandoc/Writers/CommonMark.hs @@ -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) :) diff --git a/test/command/5195.md b/test/command/5195.md new file mode 100644 index 000000000..10c542eb0 --- /dev/null +++ b/test/command/5195.md @@ -0,0 +1,7 @@ +``` +% pandoc -f markdown_strict -t gfm+hard_line_breaks +Hello +there +^D +Hello there +```