Markdown writer: include needed whitespace after HTML figure.

We use HTML for a figure in markdown dialects that can't
represent it natively.

Closes #5121.
This commit is contained in:
John MacFarlane 2018-12-03 15:10:13 -08:00
parent 80e86109a2
commit 4060df6891
2 changed files with 14 additions and 1 deletions

View file

@ -463,7 +463,7 @@ blockToMarkdown' opts (Para [Image attr alt (src,'f':'i':'g':':':tit)])
| isEnabled Ext_raw_html opts &&
not (isEnabled Ext_link_attributes opts) &&
attr /= nullAttr = -- use raw HTML
(text . T.unpack . T.strip) <$>
((<> blankline) . text . T.unpack . T.strip) <$>
writeHtml5String opts{ writerTemplate = Nothing }
(Pandoc nullMeta [Para [Image attr alt (src,"fig:" ++ tit)]])
| otherwise = blockToMarkdown opts (Para [Image attr alt (src,tit)])

13
test/command/5121.md Normal file
View file

@ -0,0 +1,13 @@
```
% pandoc -f markdown -t markdown_strict
![My caption](./my-figure.jpg){width=500px}
## Header 2
^D
<figure>
<img src="./my-figure.jpg" alt="My caption" width="500" /><figcaption>My caption</figcaption>
</figure>
Header 2
--------
```