Skip to content

Commit

Permalink
Markdown writer: include needed whitespace after HTML figure.
Browse files Browse the repository at this point in the history
We use HTML for a figure in markdown dialects that can't
represent it natively.

Closes #5121.
  • Loading branch information
jgm committed Dec 3, 2018
1 parent 80e8610 commit 4060df6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Text/Pandoc/Writers/Markdown.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)])
Expand Down
13 changes: 13 additions & 0 deletions test/command/5121.md
Original file line number Diff line number Diff line change
@@ -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
--------
```

0 comments on commit 4060df6

Please sign in to comment.