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

commit4060df6891bf38090de90081c081e80be1565193 authorJohn MacFarlane <jgm@berkeley.edu> dateMon 3 Dec 2018, 15:10 (8 years ago) parent80e8610
2 files changed+14−1
src/Text/Pandoc/Writers/Markdown.hs+1−1 test/command/5121.md+13
src/Text/Pandoc/Writers/Markdown.hs+1−1
@@ -463,7 +463,7 @@ blockToMarkdown' opts (Para [Image attr alt (src,'f':'i':'g':':':tit)])
463463 | isEnabled Ext_raw_html opts &&
464464 not (isEnabled Ext_link_attributes opts) &&
465465 attr /= nullAttr = -- use raw HTML
466− (text . T.unpack . T.strip) <$>
466+ ((<> blankline) . text . T.unpack . T.strip) <$>
467467 writeHtml5String opts{ writerTemplate = Nothing }
468468 (Pandoc nullMeta [Para [Image attr alt (src,"fig:" ++ tit)]])
469469 | otherwise = blockToMarkdown opts (Para [Image attr alt (src,tit)])
test/command/5121.mdnew file+13
@@ -0,0 +1,13 @@
1+```
2+% pandoc -f markdown -t markdown_strict
3+![My caption](./my-figure.jpg){width=500px}
4+
5+## Header 2
6+^D
7+<figure>
8+<img src="./my-figure.jpg" alt="My caption" width="500" /><figcaption>My caption</figcaption>
9+</figure>
10+
11+Header 2
12+--------
13+```