From efc6994c8a792e72ae299bc33e18327c3c4acbc9 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 23 Oct 2020 09:25:07 -0700 Subject: Commonmark writer: fix regression with fenced divs. Starting with 2.10.1, fenced divs no longer render with HTML div tags in commonmark output. This is a regression due to our transition from cmark-gfm. This commit fixes it. Closes #6768. --- src/Text/Pandoc/Writers/Markdown.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/Text/Pandoc/Writers/Markdown.hs') diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index 55f67b228..0aca83ad0 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -419,6 +419,7 @@ blockToMarkdown' :: PandocMonad m blockToMarkdown' _ Null = return empty blockToMarkdown' opts (Div attrs ils) = do contents <- blockListToMarkdown opts ils + variant <- asks envVariant return $ case () of _ | isEnabled Ext_fenced_divs opts && @@ -428,7 +429,8 @@ blockToMarkdown' opts (Div attrs ils) = do literal ":::" <> blankline | isEnabled Ext_native_divs opts || (isEnabled Ext_raw_html opts && - isEnabled Ext_markdown_in_html_blocks opts) -> + (variant == Commonmark || + isEnabled Ext_markdown_in_html_blocks opts)) -> tagWithAttrs "div" attrs <> blankline <> contents <> blankline <> "" <> blankline | isEnabled Ext_raw_html opts && -- cgit v1.2.3