Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Ask Question
What I wanted
With the nbextension
toc
, jupyter notebooks have table of content capabilities which is said to be transferable to html via
nbconvert --to html_toc function
, or via the dropdown menue "download as html with toc". However, neither option works in my case.
What I have tried
Download as html with toc initially gave an error similar to TemplateNotFound: toc2
All recommended commands like
jupyter nbconvert FILE.ipynb --template toc
jupyter nbconvert FILE.ipynb --template toc2
(These two appear to be incomplete but are supplied like this)
jupyter nbconvert --to html_toc FILE.ipynb
(same error as above via menue)
As
here
and
here
the toc2.tpl file is mentioned, I placed this file together with the main.css and toc2.js file into the same directory as the ipynb notebook to be converted. Now the download as html with toc menue gives error "nbconvert failed: toc2" and the
jupyter nbconvert FILE.ipynb --template toc2
gives error "jinja2.exceptions.TemplateNotFound: toc2"
I still have not understood the role of the toc2 template. Is it (still) necessary? Why? How (with the other files?)? Where (how is the location provided)? What exactly is needed where and how to make use of this extremely usefull functionality?
The downgrade mentioned
here
was not possible due to resulting incompab.
Used Conditions / Versions in conda virtual environment
(Please tell me if you need more information)
jupyter core : 4.7.1
jupyter-notebook : 6.2.0
qtconsole : 5.0.2
ipython : 7.20.0
ipykernel : 5.3.4
jupyter client : 6.1.7
jupyter lab : 3.0.8
nbconvert : 6.0.7
ipywidgets : 7.6.3
nbformat : 5.1.2
traitlets : 5.0.5
–
–
–
Then check that it installed nbconvert-5.6.1
(5.6.1 version).
After that, execute the following:
jupyter nbconvert --to html_toc YOURFILENAME.ipynb
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.