1

When you declare an image the usual way it works:

![alt text][1]

alt text

With links as alt text it works as well:

![http://x][1]

http://x

But when you use a - before a link:

![- http://x][1]

It does not render the image and generates an invalid HTML text output instead (with final rendering different than preview (thanks @animuson)):

  • When in preview the rendered text is http://x" title="" />.
  • In the final post, the rendered text is http://x">. See it below:

http://x">


Anything else works: ![- http://][1], ![- bla][1], ![- http:/x][1].

1
  • That difference is just because when you don't enter a title, one Markdown engine creates empty title attributes, while the other one creates none at all.
    – balpha StaffMod
    Jun 11, 2013 at 6:31

1 Answer 1

2

This is most likely the auto-linkifier acting up again. A [ character is not a valid preceder for auto-linkification. A space character, however, is. Apparently a ] is also a valid end character that stops a hyperlink (or perhaps it's seeing the end of the string depending on what order things get processed), so your ![- http://x][1] ends up looking like this after it runs through Markdown:

<img src="<a href="http://x">http://x</a>" title="" />

Once that runs through the sanitizer to remove invalid HTML:

<img src="<a href="http://x">http://x</a>" title="" />

and that's how you end up with the odd result in the rendering.

Note: Oddly enough, the title attribute only seems to get added in the post preview as you're typing, but doesn't get added in the final rendering of the post. shrugs

1
  • +1: Good catch on pointing out the difference in preview and final rendered text! I didnt notice it!
    – acdcjunior
    Jun 11, 2013 at 5:16

You must log in to answer this question.

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