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.
This commit is contained in:
parent
0cd0627f02
commit
efc6994c8a
2 changed files with 24 additions and 1 deletions
|
@ -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 <> "</div>" <> blankline
|
||||
| isEnabled Ext_raw_html opts &&
|
||||
|
|
21
test/command/6768.md
Normal file
21
test/command/6768.md
Normal file
|
@ -0,0 +1,21 @@
|
|||
```
|
||||
% pandoc -tcommonmark
|
||||
::: custom_div
|
||||
This is a div
|
||||
:::
|
||||
^D
|
||||
<div class="custom_div">
|
||||
|
||||
This is a div
|
||||
|
||||
</div>
|
||||
```
|
||||
|
||||
```
|
||||
% pandoc -tcommonmark-raw_html
|
||||
::: custom_div
|
||||
This is a div
|
||||
:::
|
||||
^D
|
||||
This is a div
|
||||
```
|
Loading…
Reference in a new issue