I noticed some weird behavior of Markdown regarding adding hyperlinks to images.

Start with an image:

![alt text][1]

  [1]: http://example.com/image.jpg

Now, highlight ![alt text][1] and hit Ctrl+L (add a hyperlink). instead of the expected prompt for hyperlink URL, you just get:

alt text

In other words, the reference to the image URL is gone entirely!

Now, let's say you manually entered that link, then added another paragraph:

[![alt text][1]][2]

second paragraph

  [1]: http://example.com/image.jpg
  [2]: http://example.com/page1.html

Now you want "second paragraph" to be a link, so you highlight it, hit Ctrl+L, and enter http://example.com/page2.html as the URL and hit OK. You get this:

[![alt text][1]][1]

[second paragraph][2]

  [1]: http://example.com/page1.html
  [2]: http://example.com/page2.html

Notice that the URL to the image has been completely removed!


Er.. what? You want an image src = an HTML page?

Images as links work fine..


[![alt text][1]][2]

second paragraph

  [1]: https://cdn.sstatic.net/stackexchange/img/logos/so/so-logo.png
  [2]: http://stackoverflow.com


alt text

second paragraph

  • 4
    He's right though, it doesn't work with the WMD buttons or the keyboard shortcuts. – balpha Jan 18 '10 at 16:45
  • it's open source. You want it that bad, go for it.. code.google.com/p/wmd-new – Jeff Atwood Jan 18 '10 at 16:52
  • 6
    i thought i explained it in a pretty clear step-by-step manner. there were two things. First: You have a post with an image. I want to make the image a clickable link. it doesn't work (with shortcut or toolbar button). Second: assuming you managed to manually create the image with hyperlink above it. if try to add another regular link in the next paragraph using the keyboard shortcut or toolbar, the reference to the image is deleted, and now you have img src=html page, which is not what should be there. – Kip Jan 18 '10 at 17:50

You must log in to answer this question.

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