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.
The reason the images on your GitHub Pages site will not display is because you're trying to call to the photos in a directory that does not exist. For example, in lasagna. html , you're trying to call to /images/lasagna. html , which does not exist within the folder that lasagna.
ipynb extension in a GitHub repository will be rendered as static HTML files when they are opened. The interactive features of the notebook, such as custom JavaScript plots, will not work in your repository on GitHub. Click on the uploaded file to view inside github viewer. You can share the highlighted URL to others.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With