Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

According to the GitHub documentation, the Markdown syntax for inserting an image is:

![GitHub Logo](/images/logo.png)
Format: ![Alt Text](url)

Following their example syntax, I can't seem to be able to make it work.

Even the GitHub logo example does not work.

What am I missing? Or is it a GitHub bug?

share|improve this question
    
Change the URL to a full path complete with the HTTP and see where that takes you –  Eight Days of Malaise Aug 2 '12 at 12:25
    
@EightDaysofMalaise: That does the trick indeed... Could you please write this as an answer? I reported the documentation error to Github. –  nic Aug 3 '12 at 1:49
add comment

2 Answers 2

up vote 19 down vote accepted

You may be missing the full path/location to the image you want to include in your Markdown file.

The example given is a relative path, where the image rests on the same server as the file. In the help, it would assume the image is actually located at:

https://github.com/images/logo.png

But that is not a valid file or location.

In order to make sure you can render an image no matter where you're viewing it from, it's safer to include the full URL, which would include the domain name.

So your example would instead be using something similar to this:

![Bilby Stampede](http://example.com/images/logo.png)
share|improve this answer
add comment

In response to the answer above:

As of January 30th, 2013, GitHub now allow relative links.

Make sure that you append ?raw=true to the end of the URL, though. Here is an example:

![Image](../blob/master/public_html/img/nokia.png?raw=true)

Due to the way GitHub handles URL's, if you do not append ?raw=true to the source URL your browser will attempt to load the page which displays the image.

share|improve this answer
    
Are you sure that update also includes using as src? –  Eight Days of Malaise Jan 31 '13 at 21:48
    
Yes, it does. Though, you have to append "?raw=true" to the end of the URL. Here's an example: ![Image](../blob/master/public_html/img/nokia.png?raw=true) –  Chris Morris Feb 1 '13 at 6:29
    
Just updated the answer :). –  Chris Morris Feb 1 '13 at 6:32
    
This works for my Markdown file but I get an error with pandoc: pandoc: Error producing PDF from TeX source. ! LaTeX Error: Unknown graphics extension: .png?raw=true. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.175 ...2014-04-08_Bergman2011_Fig2.png?raw=true} –  djhocking Apr 8 at 20:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.