Also use --execute to get the output
jupyter nbconvert --execute --to html notebook.ipynb
This produces a notebook.html file.
The best practice is to keep the output out of the notebook for version control, see: Using IPython notebooks under version control
But then, if you don't pass --execute, the output won't be present in the HTML, see also: How to run an .ipynb Jupyter Notebook from terminal?
For an HTML fragment without header: How to export an IPython notebook to HTML for a blog post?
Tested in Jupyter 4.4.0.
Answer from Ciro Santilli OurBigBook.com on Stack Overflowpython - How to convert IPython notebooks to PDF and HTML? - Stack Overflow
python - How to use nbconvert from Jupyter Notebook to HTML - Stack Overflow
Ploomber Convert: A free online tool to convert Jupyter notebooks to PDF
Exporting to HTML with ipywidgets/output rendered in document
Videos
Also use --execute to get the output
jupyter nbconvert --execute --to html notebook.ipynb
This produces a notebook.html file.
The best practice is to keep the output out of the notebook for version control, see: Using IPython notebooks under version control
But then, if you don't pass --execute, the output won't be present in the HTML, see also: How to run an .ipynb Jupyter Notebook from terminal?
For an HTML fragment without header: How to export an IPython notebook to HTML for a blog post?
Tested in Jupyter 4.4.0.
Yes you can and it's quite easy and a built in feature
jupyter nbconvert --to html notebook.ipynb
That will generate a notebook.html file. Output can be customized. Also check out the slideshow functionality (View>Cell-Toolbar>Slideshow) which can also be used with nbconvert.
Also the notebook.ipynb Jupyter file can be uploaded to Github where the current version gets rendered. Depending on what you want that information might be useful too
Also check out line/cell magic. You can run bash commands directly in your jupyter cell like so:
%%bash
convert graphviz/MyPic.jpg -resize 70% graphviz/MyPic_sm.jpg
If you have LaTeX installed you can download as PDF directly from Jupyter notebook with File -> Download as -> PDF via LaTeX (.pdf). Otherwise follow these two steps.
For HTML output, you should now use Jupyter in place of IPython and select File -> Download as -> HTML (.html) or run the following command:
jupyter nbconvert --to html notebook.ipynbThis will convert the Jupyter document file notebook.ipynb into the html output format.
Google Colaboratory is Google's free Jupyter notebook environment that requires no setup and runs entirely in the cloud. If you are using Google Colab the commands are the same, but Google Colab only lets you download .ipynb or .py formats.
Convert the html file notebook.html into a pdf file called notebook.pdf. In Windows, macOS (
brew install wkhtmltodf) or Linux, install wkhtmltopdf. wkhtmltopdf is a command line utility to convert html to pdf using WebKit. You can download wkhtmltopdf from the linked webpage, or in many Linux distros it can be found in their repositories.wkhtmltopdf notebook.html notebook.pdf
Original (now almost obsolete) revision: Convert the IPython notebook file to html.
ipython nbconvert --to html notebook.ipynb
Also pass the --execute flag to generate the output cells
jupyter nbconvert --execute --to html notebook.ipynb
jupyter nbconvert --execute --to pdf notebook.ipynb
The best practice is to keep the output out of the notebook for version control, see: Using IPython notebooks under version control
But then, if you don't pass --execute, the output won't be present in the HTML, see also: How to run an .ipynb Jupyter Notebook from terminal?
For an HTML fragment without header: How to export an IPython notebook to HTML for a blog post?
Tested in Jupyter 4.4.0.
The other answer is outdated, so I'm sharing the updated version:
Run this in the terminal:
pip install nbconvert
jupyter nbconvert notebook.ipynb --to html
nbconvert is very flexible, for example, you can convert to pdf:
jupyter nbconvert notebook.ipynb --to pdf
And there are flavors to each format. For example, to get a barebones HTML (no CSS):
jupyter nbconvert notebook.ipynb --to html --template basic
If you not afraid of command line then it must be as simple and comprehensive as this example:
ipython nbconvert --to html "C:\path\to\your_notebook.ipynb"
It will generate a HTML file named your_notebook.html at same place where your_notebook.ipynb is located.
If you need to take control over target HTML file generation you can ask ipython to output into standard output and redirect its output to whatever file you want.
Example:
ipython nbconvert --to html "C:\path\to\your_notebook.ipynb" --stdout > "C:\my\reports\fancy_analytic.html"
This will render your_notebook.ipynb in HTML format into fancy_analytics.html file.
More info here