Reputation: 23945
I have a README.md file in the root of my git repository hosted in Visual Studio Team Services.
When I navigate to the file in the web browser through the project portal I can see the correctly rendered markdown except for the images. I would like to add some screenshots to the README file and would like to know the correct way to reference an image stored stored in a folder at the root of the repository/doc/images/image01.png
As the README file is also stored at the root of the repository I thought it would just be a relative link. When using Visual Studio Code on my computer (OSX) I can use relative paths and the images render correctly using the image tag as so:

Does the image tag have to be different in order for me to view images when viewing the README file with the browser at (example url):
There is guidance from Microsoft but there must be something I am missing. When the markdown is rendered I get a missing image tag. If I open the image in a new tab I get a HTTP 500 Error and the following message:
More information about this error
The item doc/images/pullNewChangesFromMaster.png?raw=true does not exist at the specified version, or you do not have permission to access it.
I get the same error even if the addresses have or are missing a leading forward slash from the address.

or

Upvotes: 6
Views: 2794
Reputation: 6015
When dealing with images in markdown files, it's important to distinguish two types of possible errors: link errors and syntax errors.
When the link is broken, a broken-image and the text you put in []
will be displayed in rendered file. Sample:

There are cases when renderer does not accept the syntax. In that case it will display your whole text.

the outcome is like this:
The problem with second example is that it has an space character in its URL. All spaces in address should be replaced with %20
like this:

Upvotes: 0
Reputation: 1326666
Reading the Guidance page from Microsoft, I do not see ?raw=true
mentioned anywhere.
So it is best to try your relative link without it.

Upvotes: 4