diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-08-08 13:30:53 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-08-08 13:30:53 -0700 |
commit | 54658b923a6660336e7f6583d5416f786a54473a (patch) | |
tree | c34da97071ba5cdc3fe5b4c86d9516492ece707d /src | |
parent | cf54c9b3c2ccc2793a83b3f6ce05b9a29776b8cc (diff) | |
download | pandoc-54658b923a6660336e7f6583d5416f786a54473a.tar.gz |
Support `hard_line_breaks` in CommonMark reader.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Readers/CommonMark.hs | 7 |
1 files changed, 7 insertions, 0 deletions
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) |