I was editing here.

Problem #1: the curious behavior of images with angle brackets in the alt-text

Post content:

![figure demonstrate the use of ->][1]

  [1]: https://i.sstatic.net/sUIH0.gif

Post rendered as: "> (Google Chrome)

Is this the expected behaviour?

I ampersand-escaped the > to get the image to appear.

Problem #2: redundant image hosting

When I add this image from the web, it creates a new copy 3joxV.gif on i.stack.imgur.com. Even if this is just a new identifier, this seems redundant.

enter image description here

2 Answers 2


What's happening here is the first image gets rendered like this:

<img src="https://i.sstatic.net/sUIH0.gif" 
     alt="figure demonstrate the use of ->">

At which point, the HTML sanitizer gets its grubby mitts on it, thinks the first > is the end of the tag and says, "HEY! This doesn't look right... No, no no no, this doesn't look right at all - there's supposed to be a closing quotation mark before the end of the tag! I'm throwing this whole mess into the bit bucket."

...which leaves you with


The obvious solution is for the Markdown engine to do the same thing you would do if you were typing out the tag manually: escape any special characters in the alt text before inserting them into the output.

Related: Bug with images and markdown

Regarding the redundant image... You don't have to use the little "Insert an image" toolbar utility to put these in if you don't want to. If you already have an image hosted somewhere reliable (preferably on i.stack.imgur.com since we have some control over that and can prevent images from expiring...), you can just write out the Markdown directly and slap the existing image URL into it.

But it's not a big deal. Bytes are cheap.


Fixed now; angle brackets that end up in the alt (or title) attribute are now encoded. See Angle brackets in image alt texts should be auto-encoded.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .