From 54658b923a6660336e7f6583d5416f786a54473a Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 8 Aug 2017 13:30:53 -0700 Subject: Support `hard_line_breaks` in CommonMark reader. --- src/Text/Pandoc/Readers/CommonMark.hs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/Text/Pandoc/Readers') diff --git a/src/Text/Pandoc/Readers/CommonMark.hs b/src/Text/Pandoc/Readers/CommonMark.hs index 4a5081d65..14be946e6 100644 --- a/src/Text/Pandoc/Readers/CommonMark.hs +++ b/src/Text/Pandoc/Readers/CommonMark.hs @@ -54,6 +54,9 @@ readCommonMark opts s = return $ (if enabled Ext_emoji then addEmojis else id) $ + (if enabled Ext_hard_line_breaks + then walk softToHardBreaks + else id) $ nodeToPandoc $ commonmarkToNode opts' exts s where opts' = [ optSmart | enabled Ext_smart ] exts = [ extStrikethrough | enabled Ext_strikeout ] ++ @@ -61,6 +64,10 @@ readCommonMark opts s = return $ [ extAutolink | enabled Ext_autolink_bare_uris ] enabled x = extensionEnabled x (readerExtensions opts) +softToHardBreaks :: Inline -> Inline +softToHardBreaks SoftBreak = LineBreak +softToHardBreaks x = x + addEmojis :: Pandoc -> Pandoc addEmojis = walk go where go (Str xs) = Str (convertEmojis xs) -- cgit v1.2.3