yonicd
yonicd

Reputation: 518

image in github wont load in github page

i am trying to make a website from gitub and have come across a couple of problems

  1. i have a github repository https://github.com/yonicd/Elections. Images found in the \images subdir and also in the \www subdir load fine into the readme.md but when i try to get to the same images on the github web page for the site they have broken links

http://yonicd.github.io/Elections/

i am writing in the markdown the image link

![Current Day](https://github.com/yonicd/Elections/blob/master/images/LastDayPlot.png)

which as you can see is there:

https://github.com/yonicd/Elections/tree/master/images

  1. When i compile the md code in R the numbered lists come out properly but when i load the readme html from within github the numbered lists reset on each number, see in the sheet usage area.

https://github.com/yonicd/Elections

Upvotes: 0

Views: 83

Answers (1)

winseybash
winseybash

Reputation: 702

It looks like you need to change the url it's trying to get the image from.

For example:

Currently using -

<p><img src="https://github.com/yonicd/Elections/blob/master/images/pad_screen_grab.png"
alt="Snapshot of Election Analysis Page"></p>


Change to -

<p><img src="https://raw.githubusercontent.com/yonicd/Elections/master/images/pad_screen_grab.png"
alt="Snapshot of Election Analysis Page"></p>


As you can see if the you click on them the first one will link you to the location of the image in the GitHub repo whereas the second one will just give you the raw image file.

EDIT: You can see it working in this demo - http://jsfiddle.net/ghnfrr1r/

Upvotes: 2

Related Questions