Sharing some programming knowledge.


Convert jupyter notebooks to markdown, pdf or html Files

Install extensions if convert commands below can’t work

pip install jupyter_contrib_nbextensions or conda install jupyter_contrib_nbextensions

convert .ipynb to .md:

Run jupyter nbconvert --to markdown notebook.ipynb in terminal. A simple Markdown format output, cells are not affected, the code cell is indented by 4 spaces, graphs will be saved to a individual folder.

convert .ipynb to .html:

  • Option 1: run jupyter nbconvert --to html notebook.ipynb

  • Option 2: Some commands are provided in jupyter to configure the generated html format: jupyter nbconvert --to html --template full notebook.ipynb. This will provide full static HTML format, more interactive.

  • Option 3: jupyter nbconvert --to html --template basic notebook.ipynb. Simplified HTML, for embedding web blogs, etc., does not include HTML headings.

convert .ipynb to .pdf:

jupyter nbconvert --to pdf notebook.ipynb


Original version of command uses ipython: ipython nbconvert --to html notebook.ipynb. Now it is almost obsoleted.