15

I created and saved a notebook using Jupyter notebooks. I then proceeded to create a github gist of this notebook. However, the notebook is not being rendered in the gist. I can only see the raw code. I have included the link to my gist below:

https://gist.github.com/adikamath/26ae33d4fd613d716cdf01697130e675

I know that GitHub provides advanced support for ipnyb since some time now and I don't have to use a service like nbviewer to see it rendered. Any help is appreciated.

slacker92
  • 545
  • 4
  • 11
  • I found inconsistent info about rendering ipynb files in github. In [blog](https://github.com/blog/1995-github-jupyter-notebooks-3) they say they support it since May 2015. However in [help](https://help.github.com/articles/working-with-jupyter-notebook-files-on-github/) I found article saying it is not supported. Have you tried commiting `i_love_pandas.ipnyb` as a file in regular github repository, instead of making it gist? – running.t Dec 18 '17 at 12:48
  • @running.t Yes, I did commit it as a file and it renders perfectly on GitHub but I want to create a gist(one that renders by notebook) so that I can easily embed it in my jekyll-based static blog. – slacker92 Dec 19 '17 at 03:00
  • 1
    @running.t Funny thing, I just tried dragging and dropping my .ipnyb file into the gist window instead of just copying the code and pasting it in the window and now the gist renders the notebook OK! So I am going to close this question :) – slacker92 Dec 19 '17 at 03:15
  • The statement "and I don't have to use a service like nbviewer to see it rendered" is not completely accurate even now in 2022. [There's still a number of shortcomings of the Github/Gist rendering of notebooks](https://stackoverflow.com/a/72451192/8508004) & you are better off considering it as only a preview. Continue using [nbviewer](https://nbviewer.org/) provided by the Jupyter community for actual rendering & sharing with others. Any Github/Gist ipynb file URL can be rendered by nbviewer using a variation on the URL. There's a lot of effort by the community to make nbviewer work well. – Wayne Jul 27 '22 at 16:30

4 Answers4

28

I was able to make it work! Instead of copying the code from the .ipnyb file into the gist window, I dragged & dropped the whole file into the gist window and the gist renders it OK!

slacker92
  • 545
  • 4
  • 11
4

Just add.ipynb to gist file name. By default it saves as .txt file. Commit your file, you will be able to see it in form of jupyter notebook

RAJK
  • 195
  • 2
  • 9
2

Actually, I encountered a very similar problem, which did not change by copying or drag/dropping the file. The simple but somehow strange cure was to first close the jupyter notebook and then upload the notebook on gist (by drag&drop, but I think it does not matter).

Malte B
  • 41
  • 6
1

The below steps worked for me:

  1. create a new gist
  2. drag and drop your .ipynb file into the window where your code should be placed.
  3. give a name to your gist ending with .ipynb
  4. create the gist