How to add an image with link in Markdown

Today I updated the disclaimers and license section of my photography website. In doing so, I wanted to add the Creative Commons License logo with the image linking to the relevant site.

I didn't know how to do this in Markdown. After a few minutes I figured it out, it turned out to be not just easy to do, but just plain logical. That's why I love writing in Markdown. Here's how it works:

The Markdown syntax to add an image is:

    ![Alt text](/path/to/img.jpg)

This puts the image in, but it doesn't link to anywhere. To add a regular text link in Markdown, the syntax is:

    [This link](http://example.net/)

The link text is delimited by square brackets and the destination URL is delimited by regular parentheses immediately after the text link's closing bracket.

There you have the syntax for adding an image and the syntax for adding a link. If what you want is a combination of both… an image that is a link, just combine them like this:

    [![Alt text](/path/to/img.jpg)](http://example.net/)

It works perfectly. The final syntax that I used on my site is:

    [![Creative Commons License](http://i.creativecommons.org
    /l/by-nc-nd/3.0/88x31.png)](http://creativecommons.org/
    licenses/by-nc-nd/3.0/)