pythonjupyter-notebookjupyterfoldingjupyter-contrib-nbextensions

Jupyter notebook: Is there a way to fold sections while exporting to html


I am using Jupyter notebooks with jupyter-contrib-nbextensions and I can fold sections as well as code blocks in them. I want to know if there is a way to preserve the folding feature when the notebook is exported to html. Currently when I export to html, I can't fold anything. The notebook becomes cumbersome to handle if it's long, even if there's a table of contents. I'll appreciate any ideas in this regard. Thanks!


Solution

  • According to the docs for the "Collapsible Headings"-extension in nbextensions, you should be able to export a foldable html-file by using the html_ch format:

    jupyter nbconvert --to html_ch FILE.ipynb