2021-10-24

Presentations with Jupyter Notebook

Jupyter notebook is the web version of the python interactive environment (Ipython) and it can be used as a text editor for creating markdown-based presentations. Let's see how.

Download as .md file

I have an empty notebook that I use as a template for a markdown presentation, download the notebook here, and save it to the Jupyter notebook root directory.

The notebook should appear in the application's dashboard as shown in the figure below:

Open the notebook, edit the presentation, and when completed download the notebook as a markdown file. Then open the markdown file with Remarkpy after you have selected the jupytext theme.

It will display the presentation in your default browser.

A new slide, it's created after a markdown cell that contains the separator:

   ---

Jupytext

While simple, this workflow has a very annoying problem: each time I modify the notebook I have to download the correspondent markdown file again.

This can be solved with a really useful python module,Jupytext. It provides two-way conversion between Jupyter and Markdown, note that an extension for VIM also exists.

It can be installed simply with:

   pip install jupytext

Now, when you open the notebook you should be able to notice, inside the File menu, the jupytext submenu. Select pair notebook with markdown, this creates a markdown file with the same filename that will be updated each time you save the notebook.

The Jupytext theme automatically filters out the header before it displays the presentation.