Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to upload Jupyter notebooks using blogdown on netlify?

I would like to upload my Jupyter notebook on my website using Blogdown/Netlify?

When I converted my ipynb to md, and added info to the YAML, I was able to upload it. But this upload causes it to follow the specific format/theme of the website. I want the Jupyter notebooks to be rendered in their own format/theme (the HTML file after ipynb convert) (visually).

It uploads like this:

Website theme format: Website theme format

My process for getting the above is:

  • Make jupyter notebook
  • Download as md
  • Copy contents of md into new Rmd
  • Serve site

I want it to upload like this:

Jupyter notebook theme format: Jupyter notebook theme format


As mentioned in comments, when I download ipynb as html, edit the html to include the yaml, and then if I serve site, I get the following, which is not the same as what I want. I want the publish to fit the window, not add a horizontal scroll on its own.

Jupyter notebook format not what I want


So now I have the following choices:

  1. Convert to md, copy paste into Rmd, push.
  2. Convert to html, edit to include yaml, push (don't like display).
  3. Convert to md, add yaml, push (almost same as step 1).
  4. Just link a blog post to my github, where I can render my ipynb.
like image 533
scientific_explorer Avatar asked Mar 10 '18 10:03

scientific_explorer


1 Answers

I think this can help you : https://pypi.python.org/pypi/hugo_jupyter/1.0.2
It allows to publish some jupyter notebook on a hugo website.

Basically, you will have a special directory for notebooks and a mechanism to add the front matter that hugo need.

It should be compatible with blogdown that is wrapping hugo. You may have to play with some options to indicate to blogdown how to handle this. Basically, blogdown handles all the Rmd files then uses hugo to build the site. You should be able to skip the first part for your notebook.

If you only uses python and no Rmarkdown files, maybe hugo and hugo-jupyter are enough for you, and no need for blogdown.

like image 70
cderv Avatar answered Nov 08 '22 19:11

cderv