Visualizing ipython on github - github

Is it possible to render a .ipynb file on github the way .md files are rendered? Basically I am asking if it somehow possible to embed the notebook viewer

GitHub supports several formats for README-type files, but IPython notebooks aren't listed among them.
If you are trying to do this with GitHub Pages (static sites hosted on GitHub), manually converting your notebooks to HTML with nbconvert might be useful:
ipython nbconvert --to html --template full notebook.ipynb
This should output an HTML file and a directory containing images and other files.
If you have LaTeX formulas, they should be handled client-side with MathJax.

Related

Install Jupyter Notebook extensions on copy hosted on cloned Github Repository?

I have a cloned Jupyter Notebook hosted on Github. Locally, I have installed Jupyter Notebook extensions but these are not maintained within the Github environment.
Is there a way to install the extensions on the Github server so that cells can be toggled on/off with notebook extensions? Or will I have to go with a Javascript hack as per https://gist.github.com/Zsailer/5d1f4e357c78409dd9a5a4e5c61be552?
It appears this cant' be done as per below:
When you add Jupyter Notebook or IPython Notebook files with a .ipynb extension on GitHub, they will render as static HTML files in your repository.
The interactive features of the notebook, such as custom JavaScript plots, will not work in your repository on GitHub. For an example, see Linking and Interactions.ipynb.
To view your Jupyter notebook with JavaScript content rendered or to share your notebook files with others you can use nbviewer. For an example, see Linking and Interactions.ipynb rendered on nbviewer.
from: https://help.github.com/en/articles/working-with-jupyter-notebook-files-on-github

Jupyter Github Code Review

When doing a code review on jupyter notebooks in github, it shows only the html code that generates the notebook. Are there any extensions that would enable github to show the rendered jupyter notebook, along with the ability to comment on cells for code review?
Under the hood Notebook files are JSON documents. All the markdown, code, outputs are present in this JSON document. Since git diff used by GitHub is meant for text files, it's hard to read Jupyter Notebook diffs on GitHub.
I built a GitHub app ReviewNB specifically to review Jupyter Notebooks on GitHub. It integrates directly with your repositories on GitHub and provides visual diff and commenting support (see screenshot below).
There's also nbdime if you just want to access rendered diff locally.

How to get github to show my jupyter notebook images?

Github is not showing the images in my jupyter notebook.
I have tried pushing different formats such as:
![alt text](img/file.png)
and
<img src="img/file.png", width=200, height=200>
which they do work on my local jupyter notebooks in regards of showing images, but once I pushed these notebooks to Github, everything works fine in my repository, but the images won't show.
here is an example
As mentioned in my comment, when something like this happens please ensure that you are uploading the relevant files and that the path you are uploading the files to is still valid relative to the notebook.

Latex macros in Jupyter (iPython) notebook not rendered by github

I have a markdown cell in a Jupyter notebook (.ipynb) with the following content.
$\newcommand{\paren}[1]{\left(#1\right)}$
$\paren{\beta^2}$
The file is in a Github repository. The LaTex macro application is not rendered by Github.
Here is how it looks:
The markdown cell, however, is rendered properly when I open is locally as a Jupyter notebook.
Is there a way to make this work? Note that the file is in a private Github repo, so I can not use nbviewer.

markdown tables on GitHub via Pandoc

When I combine several .md files with tables into a single .pdf and a single .md file using Pandoc, only the .pdf maintains formatting. I created a simple repository that has four .md files showing each table example on the Pandoc website.
I compiled with the following commands:
pandoc -o README.md *.md
pandoc -o README.pdf *.md
As you can see from the repository, the (pdf) looks fine, but the markdown file showing on GitHub as the readme does not.
Also, of the four individual .md files, only the pipe table shows correctly on GitHub.
Questions:
What type of markdown tables are supported by GitHub? Tables are not addressed in this spec sheet.
Pandoc seems to be the best way to combine multiple .md files into one doc, but the formatting does not hold when outputting to .md. Looks fine for .pdf. Why? And is there a fix?
You're correct that the GitHub documentation doesn't say what kind of tables GFM supports. I think your test shows that it supports pipe tables. Since Pandoc can natively output GFM (see below), that's likely your best bet.
You can specify the precise output format using the -t option. In this case:
pandoc -o whole-thing.md -t gfm *.md
The supported output formats are listed in the Pandoc README.