git.iko.soy/typeable/pandoc
on master help sign in
Commonmark writer: Use backslash escapes for `<` and `|`...

instead of entities. Closes #7208.

commit60974538b25657c9aa37e72cc66ca3957912ddec authorJohn MacFarlane <jgm@berkeley.edu> dateMon 5 Apr 2021, 23:29 (6 years ago) parent21fed4a
2 files changed+17−1
src/Text/Pandoc/Writers/Markdown.hs+11−1 test/command/7208.md+6
src/Text/Pandoc/Writers/Markdown.hs+11−1
@@ -67,7 +67,17 @@ writePlain opts document =
6767-- | Convert Pandoc to Commonmark.
6868writeCommonMark :: PandocMonad m => WriterOptions -> Pandoc -> m Text
6969writeCommonMark opts document =
70− evalMD (pandocToMarkdown opts document) def{ envVariant = Commonmark } def
70+ evalMD (pandocToMarkdown opts' document) def{ envVariant = Commonmark } def
71+ where
72+ opts' = opts{ writerExtensions =
73+ -- These extensions can't be enabled or disabled
74+ -- for commonmark because they're part of the core;
75+ -- we set them here so that escapeText will behave
76+ -- properly.
77+ enableExtension Ext_all_symbols_escapable $
78+ enableExtension Ext_pipe_tables $
79+ enableExtension Ext_intraword_underscores $
80+ writerExtensions opts }
7181
7282pandocTitleBlock :: Doc Text -> [Doc Text] -> Doc Text -> Doc Text
7383pandocTitleBlock tit auths dat =
test/command/7208.mdnew file+6
@@ -0,0 +1,6 @@
1+```
2+% pandoc -t gfm
3+\<hi\>
4+^D
5+\<hi\>
6+```