git.iko.soy/typeable/pandoc
on master help sign in
Support `hard_line_breaks` in CommonMark reader.
commit54658b923a6660336e7f6583d5416f786a54473a authorJohn MacFarlane <jgm@berkeley.edu> dateTue 8 Aug 2017, 13:30 (9 years ago) parentcf54c9b
1 file changed+7
src/Text/Pandoc/Readers/CommonMark.hs+7
src/Text/Pandoc/Readers/CommonMark.hs+7
@@ -54,6 +54,9 @@ readCommonMark opts s = return $
5454 (if enabled Ext_emoji
5555 then addEmojis
5656 else id) $
57+ (if enabled Ext_hard_line_breaks
58+ then walk softToHardBreaks
59+ else id) $
5760 nodeToPandoc $ commonmarkToNode opts' exts s
5861 where opts' = [ optSmart | enabled Ext_smart ]
5962 exts = [ extStrikethrough | enabled Ext_strikeout ] ++
@@ -61,6 +64,10 @@ readCommonMark opts s = return $
6164 [ extAutolink | enabled Ext_autolink_bare_uris ]
6265 enabled x = extensionEnabled x (readerExtensions opts)
6366
67+softToHardBreaks :: Inline -> Inline
68+softToHardBreaks SoftBreak = LineBreak
69+softToHardBreaks x = x
70+
6471addEmojis :: Pandoc -> Pandoc
6572addEmojis = walk go
6673 where go (Str xs) = Str (convertEmojis xs)