So I complety reworked the design of my Jekyll code posts to extract them completely from Jupyter notebooks.

My approach for doing this was mainly based on a post by @AdamChainz but I changed a thing or two.

What did I changed :

  • I wanted the In: [12] to display more like in a real notebook
  • I updated the expected format to Notebook v4
  • I didn’t need the ipython specific markup language

You can take my updated script and the associated Jekyll template and style from a simple Gist or if you want to be sure to get the latest version (because I might not update the gist everytime), you’ll find everything in the source of this very blog (script, template, scss at the bottom).

It’s probably worth noting that I didn’t have the opportunity to see if exceptions displayed properly, probably on a next post.

I also switched syntax highlighting to monokai.

So thanks again to @AdamChainz