This page was generated from doc/nbconvert.jupyter. Interactive online version: Binder badge.

Notebook format conversions with nbconvert§

During the installation of jupyter_format (see Installation), so-called “entry points” for nbconvert are configured automatically.

You can convert .ipynb notebooks to .jupyter notebooks with

python3 -m nbconvert --to jupyter my-old-notebook.ipynb

To convert a .jupyter notebook to any format supported by nbconvert, just append -from-jupyter to the desired format.

For example, you can convert a .jupyter notebook to the traditional .ipynb format:

python3 -m nbconvert --to ipynb-from-jupyter my-new-notebook.jupyter

Or you can convert a .jupyter file to an HTML file:

python3 -m nbconvert --to html-from-jupyter my-new-notebook.jupyter

Same for slides-from-jupyter, latex-from-jupyter, pdf-from-jupyter etc.

But enough for the theory, let’s try it with this very notebook, shall we?

!python3 -m nbconvert --to ipynb-from-jupyter nbconvert.jupyter --output=my-new-notebook
[NbConvertApp] Converting notebook nbconvert.jupyter to ipynb-from-jupyter
[NbConvertApp] Writing 4032 bytes to my-new-notebook.ipynb

Just to make sure it is actually using Jupyter’s JSON format, let’s peek at the beginning of the file:

!head my-new-notebook.ipynb
 "cells": [
   "cell_type": "markdown",
   "metadata": {
    "nbsphinx": "hidden"
   "source": [
    "This notebook is part of the `jupyter_format` documentation:\n",

Here’s a link to the new file for your perusal: my-new-notebook.ipynb.

Now let’s convert this back to .jupyter:

!python3 -m nbconvert --to jupyter my-new-notebook.ipynb
[NbConvertApp] Converting notebook my-new-notebook.ipynb to jupyter
[NbConvertApp] Writing 2686 bytes to my-new-notebook.jupyter

Again, we take a peek:

!head my-new-notebook.jupyter
nbformat 4
nbformat_minor 2
    This notebook is part of the `jupyter_format` documentation:
     "nbsphinx": "hidden"

And a link for closer inspection: my-new-notebook.jupyter.

Finally, let’s try to convert this .jupyter file to an HTML page:

!python3 -m nbconvert --to html-from-jupyter my-new-notebook.jupyter
[NbConvertApp] Converting notebook my-new-notebook.jupyter to html-from-jupyter
[NbConvertApp] Writing 277758 bytes to my-new-notebook.html
from IPython.display import IFrame
IFrame('my-new-notebook.html', width='100%', height=350)

And for completeness’ sake, a link: my-new-notebook.html.