diff options
-rw-r--r-- | src/Text/Pandoc/Writers/Markdown.hs | 12 | ||||
-rw-r--r-- | test/command/7208.md | 6 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index 4d9f3d5b0..daf45ed53 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -67,7 +67,17 @@ writePlain opts document = -- | Convert Pandoc to Commonmark. writeCommonMark :: PandocMonad m => WriterOptions -> Pandoc -> m Text writeCommonMark opts document = - evalMD (pandocToMarkdown opts document) def{ envVariant = Commonmark } def + evalMD (pandocToMarkdown opts' document) def{ envVariant = Commonmark } def + where + opts' = opts{ writerExtensions = + -- These extensions can't be enabled or disabled + -- for commonmark because they're part of the core; + -- we set them here so that escapeText will behave + -- properly. + enableExtension Ext_all_symbols_escapable $ + enableExtension Ext_pipe_tables $ + enableExtension Ext_intraword_underscores $ + writerExtensions opts } pandocTitleBlock :: Doc Text -> [Doc Text] -> Doc Text -> Doc Text pandocTitleBlock tit auths dat = diff --git a/test/command/7208.md b/test/command/7208.md new file mode 100644 index 000000000..e65943ade --- /dev/null +++ b/test/command/7208.md @@ -0,0 +1,6 @@ +``` +% pandoc -t gfm +\<hi\> +^D +\<hi\> +``` |