From 4060df6891bf38090de90081c081e80be1565193 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 3 Dec 2018 15:10:13 -0800 Subject: [PATCH] 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. --- src/Text/Pandoc/Writers/Markdown.hs | 2 +- test/command/5121.md | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 test/command/5121.md diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index 6f3160ed2..c0c6e8ebf 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -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)]) diff --git a/test/command/5121.md b/test/command/5121.md new file mode 100644 index 000000000..9003cdfec --- /dev/null +++ b/test/command/5121.md @@ -0,0 +1,13 @@ +``` +% pandoc -f markdown -t markdown_strict +![My caption](./my-figure.jpg){width=500px} + +## Header 2 +^D +
+My caption
My caption
+
+ +Header 2 +-------- +```