Reputation: 4927
How to add an image that is also a link to an external page on Github's README.md?
Adding a markdown to display an image is pretty simple (answer at How to add images to README.md on GitHub?). Adding a link is also pretty simple (GitHub relative link in Markdown file), but it seems there's is no way to add an image that is also a link to an external site.
<a href="https://stackoverflow.com/"><img src="RELATIVE_PATH_TO_IMAGE"></img></a>
Upvotes: 68
Views: 52520
Reputation: 762
Structure:
[](link to your URL)
Example:
[(Youtube)](https://www.youtube.com/watch?v=3HIr0imLgxM)
Upvotes: 8
Reputation: 327
Some additional syntax mixing html and markdown, giving you more flexibility in adjusting how image is displayed.
Assuming you have repo structure as follows (it just refers to relative link used in syntax below):
you can use
[<img alt="alt_text" width="40px" src="images/image.PNG" />](https://www.google.com/)
Upvotes: 10
Reputation: 1329692
Try simply the syntax:
[](link to your URL)
[<img src="path/to/image.png">](https://link-to-your-URL/)
,README
as an example, from commit a932f85.That will wrap the image as a link
Upvotes: 117
Reputation:
The people who wrote the previous answers were overcomplicating it. This works in Markdown+HTML5 and is easy to understand when looking at the source code.
The code: [<img src="img/myImage.png">](http://example.com/)
,
where img/myImage.png
should be replaced by the relative path to your image, and http://example.com/
should be replaced by the link you want to visit when the image is clicked.
Upvotes: 7