ericmjl
ericmjl

Reputation: 14684

nbconvert: exporting to another directory?

I'm wondering if it's possible to export a Jupyter notebook to a different directory than the same directory as the notebook itself? I'm using this to build HTML versions of the notebooks, and I'd like them to reside under docs/ in my GitHub repo (this is to take advantage of GH-pages).

Upvotes: 8

Views: 11211

Answers (1)

Doug Hudgeon
Doug Hudgeon

Reputation: 1529

NBConvert's --output-dir argument does this: https://nbconvert.readthedocs.io/en/latest/config_options.html

You can use it from the command line or from within a Jupyter notebook.

Command line:

jupyter nbconvert --output-dir='./docs' --to html my_notebook_to_be_converted.ipynb

From within a Jupyter Notebook cell:

!jupyter nbconvert --output-dir='./docs' --to html my_notebook_to_be_converted.ipynb

Note that you don't need to use "--to html" to convert a notebook to html because the default output format is html. I've included the argument solely for clarity.

Upvotes: 16

Related Questions