finefoot
finefoot

Reputation: 11272

Image in Jupyter Notebook ipynb doesn't show up in GitHub private repo but the same code works with public repo

I have a Jupyter Notebook .ipynb file in my GitHub repository. It is supposed to show an image via the following markdown code:

![image](image.png)

The image does show up when the repository is public. However, when the repository is set to private, only the alternative caption "image" is visible and the image doesn't load. If I right-click on it and select "View Image", the image loads fine.

The issue also doesn't exist for .md Markdown files: the same line above works for public and private repos.

There is this answer which describes how to embed images into the .ipynb file, but that's not what I'm looking for. I want to display the .png file dynamically.

Upvotes: 11

Views: 7810

Answers (5)

William Le
William Le

Reputation: 1171

Paste Image From Clipboard Into Markdown Cell

I found out that I only needed to do a simple copy an image Ctrl + C and then paste into markdown cell with Ctrl + V.

The link to an image should look something like this:

![image.png](attachment:image.png)

Only then the image became visible in my private repo! Something like the following DID NOT WORK for me:

![](images/sample-image.png)

Upvotes: 0

chiceman
chiceman

Reputation: 106

When I made my repo public, Github required me to confirm my credentials, but as soon as it was public, the images rendered. It could have been either so I'd suggest either logging out / in or making your repo public (then taking immediately private again if need be).

Upvotes: 2

Reza Ansari
Reza Ansari

Reputation: 1

I have tested most of the comments; however, only the following works for me:

  1. Build the folder in the same repository with the image name.
  2. Create a file .gitkeep in the Image folder.
  3. Upload your images in this folder.
  4. Add address like: <img src='Image/name.PNG' />
  5. Note: building Image folder is necessary.

Upvotes: 0

LOrD_ARaGOrN
LOrD_ARaGOrN

Reputation: 4506

I struggled a lot, than at last was able to fix it.

  1. Use "/" instead of "\" in image path

enter image description here

  1. If you are using width field for png image file than .png should be small, width="200" number should be in quotes, img should be closed like this ->img src="Image/neuron-1.png" width="300" />

Upvotes: 0

TomNash
TomNash

Reputation: 3288

As of 2015, Jupyter notebooks are rendered on GitHub using nbviewer. From this blog post they state:

Second, because of security concerns, some features available on nbviewer will not be available on GitHub. For example, GitHub will not render any dynamic output display that uses JavaScript, custom CSS, and most custom HTML embedded in Markdown or in outputs. When this is the case, and GitHub cannot fully render your notebooks, you will see an icon that allows you to view the full notebook on nbviewer.

An issue thread has some users saying that logging out/logging in will resolve the issue. Others say it is resolved over time. But there seems to be no recognized solution.

Upvotes: 2

Related Questions