git.iko.soy/typeable/pandoc
on master help sign in
Markdown writer: don't replace empty alt in image with "image".

Previously `<img src="empty.png" alt=""/>` would be translated as `![image](empty.png)`; now it becomes `![](empty.png)` as one might naturally expect.

commit0afd33e4c51ca1f19d041d1504bc35600b2786e6 authorJohn MacFarlane <fiddlosopher@gmail.com> dateTue 3 Apr 2012, 18:28 (15 years ago) parent30a99ec
1 file changed+3−3
src/Text/Pandoc/Writers/Markdown.hs+3−3
src/Text/Pandoc/Writers/Markdown.hs+3−3
@@ -516,9 +516,9 @@ inlineToMarkdown opts (Link txt (src, tit)) = do
516516 else "[" <> linktext <> "](" <>
517517 text src <> linktitle <> ")"
518518inlineToMarkdown opts (Image alternate (source, tit)) = do
519− let txt = if (null alternate) || (alternate == [Str ""]) ||
520− (alternate == [Str source]) -- to prevent autolinks
521− then [Str "image"]
519+ let txt = if null alternate || alternate == [Str source]
520+ -- to prevent autolinks
521+ then [Str ""]
522522 else alternate
523523 linkPart <- inlineToMarkdown opts (Link txt (source, tit))
524524 return $ "!" <> linkPart