git.iko.soy/typeable/pandoc
on master help sign in
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

commitc550bf8482310dfbcb20694e7bc969d19acc5f7d authorJan Tojnar <jtojnar@gmail.com> dateSat 5 Jun 2021, 16:34 (5 years ago) parent7a3ee9d
1 file changed+6−3
src/Text/Pandoc/Writers/Markdown.hs+6−3
src/Text/Pandoc/Writers/Markdown.hs+6−3
@@ -322,9 +322,12 @@ blockToMarkdown' opts (Div attrs ils) = do
322322 case () of
323323 _ | isEnabled Ext_fenced_divs opts &&
324324 attrs /= nullAttr ->
325− nowrap (literal ":::" <+> classOrAttrsToMarkdown attrs) $$
326− chomp contents $$
327− literal ":::" <> blankline
325+ let attrsToMd = if variant == Commonmark
326+ then attrsToMarkdown
327+ else classOrAttrsToMarkdown
328+ in nowrap (literal ":::" <+> attrsToMd attrs) $$
329+ chomp contents $$
330+ literal ":::" <> blankline
328331 | isEnabled Ext_native_divs opts ||
329332 (isEnabled Ext_raw_html opts &&
330333 (variant == Commonmark ||