5

I would like to export my Jupyter notebook to html displaying the table of contents (toc2) AND hiding the input cells at the same time in the export.

I use a template to hide the code (https://github.com/ihuston/jupyter-hide-code-html), which works fine for itself.

For displaying the table of contents I run the command jupyter nbconvert --to html_toc FILE.ipynb, which works as well.

As soon as I try to combine both by jupyter nbconvert --to html_toc --template HIDE_CELL FILE.ipynb, only cells are hidden, but the toc is not shown anymore. Has anyone found a solution to combine both functions?

Thank you for your help!

Zoe_89
  • 93
  • 1
  • 6

1 Answers1

5

I tried this command below and it hides the code and generates table of contents:

jupyter nbconvert /path/filename --to=html_toc --TemplateExporter.exclude_input=True

The above worked for: Ubuntu 18.10 and jupyter lab.

Chabo
  • 2,842
  • 3
  • 17
  • 32
user2919106
  • 51
  • 1
  • 3
  • Thanks. This works but images are saved in a separate directory along with the html. Is there a way to embed the images within the exported html. So, html -> with toc, no code and embedded images. – user2688158 Jun 08 '20 at 06:43
  • 1
    This has to have toc2 or toc3 nbextensions installed, it does not work with jupyter basic toc or the jupyterlab toc extension. – thadk Aug 29 '20 at 02:46