Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

What's the recommended syntax for an image with a hyperlink? I tried doing it with the markdown toolbar buttons and the image and link buttons conflict with each other, so I had to resort to HTML.

For example, to do this:

alt text

These work properly:

<a href="">![alt text][1]</a>

<a href="">
   <img src="">

[<img src="">][2]

This does not:

<a href=''>![alt text][1]</a>

(single quotes not allowed?)

Is there a way to do the same thing in Markdown without having to resort to HTML?

Return to FAQ index

share|improve this question
up vote 102 down vote accepted

It is possible to use Markdown for both the image and the link. You'll have to do it manually because, as you said, the toolbar isn't smart enough to do it for you:

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

  [2]: (hover text)

alt text

share|improve this answer
In other words, whatever the syntax for the image, treat that whole syntax as the text to link. So the ugly syntax also works: [![alt text](image link)](web link) – ShreevatsaR Jan 9 '11 at 5:55
Excellent! It makes sense but I never got that far in because once I start typing it I think to myself, this can't possibly be right, it's too ugly. but it aint... you ugly! ;) – Flowpoke Mar 21 '11 at 17:00
This works in general for Markdown, not only for StackOverflow, it seems! – fatuhoku Aug 19 '13 at 23:52
+1 for the (hover text) tip. – Mogsdad Jun 27 '15 at 13:14

You must log in to answer this question.

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