diff options
author | Jan Tojnar <jtojnar@gmail.com> | 2021-06-05 16:34:27 +0200 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-06-05 13:51:18 -0600 |
commit | c550bf8482310dfbcb20694e7bc969d19acc5f7d (patch) | |
tree | 159610a742a70a3b68c05ae2d24989dd18242afd | |
parent | 7a3ee9d3d83b73cb53de80e01a9968ebf8f7cf12 (diff) | |
download | pandoc-c550bf8482310dfbcb20694e7bc969d19acc5f7d.tar.gz |
CommonMark writer: do not use simple class for fenced-divs
In https://github.com/jgm/pandoc/pull/7242, we introduced a simple attribute style for for code blocks and fenced divs with a single class but turns out the CommonMark extension does not support it for fenced divs.
https://github.com/jgm/commonmark-hs/blob/master/commonmark-extensions/test/fenced_divs.md
-rw-r--r-- | src/Text/Pandoc/Writers/Markdown.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index 6316d9419..b16c71358 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -322,9 +322,12 @@ blockToMarkdown' opts (Div attrs ils) = do case () of _ | isEnabled Ext_fenced_divs opts && attrs /= nullAttr -> - nowrap (literal ":::" <+> classOrAttrsToMarkdown attrs) $$ - chomp contents $$ - literal ":::" <> blankline + let attrsToMd = if variant == Commonmark + then attrsToMarkdown + else classOrAttrsToMarkdown + in nowrap (literal ":::" <+> attrsToMd attrs) $$ + chomp contents $$ + literal ":::" <> blankline | isEnabled Ext_native_divs opts || (isEnabled Ext_raw_html opts && (variant == Commonmark || |