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="http://meta.stackoverflow.com/users/44330/jason-s">![alt text][1]</a>
[1]: http://www.gravatar.com/avatar/dd5a7ef1476fb01998a215b1642dfd07?s=128&d=identicon&r=PG

<a href="http://meta.stackoverflow.com/users/44330/jason-s">
   <img src="http://www.gravatar.com/avatar/dd5a7ef1476fb01998a215b1642dfd07?s=128&d=identicon&r=PG">
</a>

[<img src="http://www.gravatar.com/avatar/dd5a7ef1476fb01998a215b1642dfd07?s=128&d=identicon&r=PG">][2]
[2]: http://meta.stackoverflow.com/users/44330/jason-s

This does not:

<a href='http://meta.stackoverflow.com/users/44330/jason-s'>![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]

  [1]: http://meta.stackoverflow.com/users/44330/jason-s
  [2]: http://www.gravatar.com/avatar/dd57e..dfd07?s=128&d=identicon&r=PG (hover text)

alt text

share|improve this answer
14  
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 .