How to display images in Markdown files on Github?

GithubMarkdown

Github Problem Overview


I want to display some images in a Markdown file on Github. I found it works this way:

![Figure 1-1](https://raw.github.com/username/repo/master/images/figure 1-1.png "Figure 1-1")

But i need to collaborate with others so i don't want the username and repo name hard coded .

I tried to use this:

![Figure 1-1](images/figure 1-1.png "Figure 1-1")

It works on my local disk but not work on Github.

Is there anyone knows about this issue?

Github Solutions


Solution 1 - Github

I found the answer myself.

Just simply append ?raw=true to the image url will make the trick:

![](images/table 1-1.png?raw=true)

Solution 2 - Github

I just had the same issue and it turned out to be caused by the space in the URL. Manually URL encoding the space as %20 fixed it.

So using your example I changed:

![](images/table 1-1.png)

to:

![](images/table%201-1.png)

2021 Edit: Thanks Emilio for pointing out that the GitHub flavored markdown spec has been updated to allow spaces in filenames when the filename is enclosed inside "pointy" (angle) brackets:

The destination can only contain spaces if it is enclosed in pointy brackets
Example 498
[link](</my uri>) --> <p><a href="/my%20uri">link</a></p>

Ref: https://github.github.com/gfm/#example-498 (scroll up for description)

This works with images too so we can now also use:

![](<images/table 1-1.png>)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionWoooHaaaaView Question on Stackoverflow
Solution 1 - GithubWoooHaaaaView Answer on Stackoverflow
Solution 2 - GithubfozView Answer on Stackoverflow