The nbconvert tool, jupyter nbconvert
, converts notebooks to various other
formats via Jinja templates. The nbconvert tool allows you to convert an
.ipynb
notebook file into various static formats including:
- HTML
- LaTeX
- Reveal JS
- Markdown (md)
- ReStructured Text (rst)
- executable script
From the command line, use nbconvert to convert a Jupyter notebook (input) to a a different format (output). The basic command structure is:
$ jupyter nbconvert --to <output format> <input notebook>
where <output format>
is the desired output format and <input notebook>
is the
filename of the Jupyter notebook.
Convert Juptyer notebook file, mynotebook.ipynb
, to HTML using:
$ jupyter nbconvert --to html mynotebook.ipynb
This command creates an HTML output file named mynotebook.html
.
Check if pandoc is installed (pandoc --version
); if needed, install:
sudo apt-get install pandoc
Or
brew install pandoc
Install nbconvert for development using:
git clone https://github.com/jupyter/nbconvert.git
cd nbconvert
pip install -e .
Running the tests after a dev install above:
pip install nbconvert[test]
py.test --pyargs nbconvert