Support hard_line_breaks
in CommonMark reader.
This commit is contained in:
parent
cf54c9b3c2
commit
54658b923a
1 changed files with 7 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue