Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Images in markdown files in GitHub Enterprise

I'm working on a README.md file in a GitHub Enterprise repository.

It's funny, I'm using the same code snippet I use in my public repositories, i.e.

![alt text](https://raw.github.com/repository/project/master/filename.png)

Unfortunately, this kind of command doesn't work on the enterprise project.

I see one big difference in the raw version of a picture. Specifically, in the enterprise repository I have a the URL of the raw picture file with a query parameter, e.g.

?token=AAABGqiVI6Qk6Mi4ZM0ZBeHrXexkUBmNks5W_AyCwA%3D%3D

Does someone know how to embed a picture in a markdown in GutHub enterprise?

like image 847
JeanValjean Avatar asked Mar 24 '16 15:03

JeanValjean


1 Answers

Have you tried working with using relative links to your images? So trying to do something like ![](img/image_name.png)? The reason why I recommend this is because if they are working with your repo, they should have these images regardless and if they are accessing this online, GitHub will handle the rendering properly. This is assuming that you want this information to be facing towards others to be able to see it.

It is actually recommended by GitHub to not use absolute links such as [Absolute README link](https://github.com/username/repo/blob/branch/docs/more_words.md) Source

Edit: I also found this question/answer on SO that might be useful to refer to about how to solve it. It also mentions with the relative linking:

GitHub recommend that you use relative links with the ?raw=true parameter to ensure forked repos point correctly.

It also talks about how you can have a separate branch that can contain all of your screenshots and you can reference them as: ![Alt text](/../<branch name>/path/to/image.png?raw=true "Optional Title")

Hope this helps!

like image 106
Prince Wilson Avatar answered Oct 08 '22 03:10

Prince Wilson