Notion app logo
Struggling to stay organized and effective? Learn to master your time and tasks with the Effectively Notion course!

Set An Anchor Link On An Image In Markdown

Learn how to create an anchor link on an image in Markdown.


I use Markdown daily in writing blog posts, README's or answering questions on One undocumented capability of markdown is how to create an image inside an anchor.

This week, I was drafting a post where I wanted to use book covers and have them link to their Amazon product page. I haven't done it before, but I figured, "Hey, this should be simple, I'll check the docs!" 30 minutes after scouring the docs, I realized it wasn't there. So I decided to experiment.

I knew how to create anchors using both inline and reference styles:

<!-- Reference -->
[My Bower Link][1]

<!-- Inline -->
[My Bower Link](

As well as how to create Images using both inline and reference styles:

<!-- Reference -->
![ A Frontend Package Manager. logo][2]

<!-- Inline -->
![ A Frontend Package Manager. logo](

So I decided to wrap a referenced image within an referenced anchor, making the image the link content:

<!-- The link we want our bower bird to point to -->
<!-- The image url we want to use for our img tag source -->

This will compile to two html nodes:
  Anchor:   [linked item][1]: <a href="1">linked item</a>
  image: /i  ![alt text][2]: <img src="2" alt="alt text" />
The image node will be nested inside of the anchor node.
[![ A Frontend Package Manager. logo][2]][1]

and voila, here's the output: A Frontend Package Manager. logo

If you hover over the Bower bird, you'll see that it is, indeed, a link.

Photo of Chase Adams

Hey, I'm Chase. I help aspiring entrepreneurs and makers turn their ideas into digital products and apps.


Vector Arrow Scribbles
banner image for figma vector arrows scribbles

A figma community project of vectorized hand-drawn arrows.

Go To Figma
Vector Line Scribbles
banner for figma vector line scribbles

A figma community project of vectorized hand-drawn lines.

Go To Figma
Vector Shape Scribbles
banner image of figma vector shapes scribbles

A figma community project of vectorized hand-drawn shapes.

Go To Figma

Subscribe to my Newsletter

Every other week I publish the Curiously Crafted newsletter.

In it, I explore the intersection of curiosity and craft: the people who make stuff, what they make and the way they pursue the craft of making.


I'm on almost all social media as @curiouslychase.

The curious logo of Chase Adams: glasses and a bow tie.stay curious.