jupyterlab / jupyterlab-toc

Table of Contents extension for JupyterLab
BSD 3-Clause "New" or "Revised" License
728 stars 106 forks source link

Insert TOC cell in notebook #84

Open pierreguilmin opened 5 years ago

pierreguilmin commented 5 years ago

Hi,

Thank you for your great extension! Would it be possible to add a feature allowing the user to insert a TOC cell in the notebook? Best would be that this TOC cell automatically refreshes itself when changes are made to the headings, but if it is too hard there could also be a button "refresh TOC cell".

I can help working on it if you give me a few guidelines.

Possibly related to #32.

maxpv commented 5 years ago

Would be indeed a valuable feature, for instance when you simply want to export your notebook as a navigable report. Thanks for the extension btw.

joelostblom commented 5 years ago

This would be great for sharing the HTML-version of the notebook!

lambdamusic commented 5 years ago

Totally agree. This would make browsing a stand-alone notebook much much more natural.

westurner commented 4 years ago

toc2 supports exporting the TOC with the notebook through nbconvert templates: https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/nbextensions/toc2/README.html#export

https://github.com/ipython-contrib/jupyter_contrib_nbextensions/tree/master/src/jupyter_contrib_nbextensions/nbextensions/toc2

https://github.com/ipython-contrib/jupyter_contrib_nbextensions/blob/master/src/jupyter_contrib_nbextensions/nbconvert_support/toc2.py

joelostblom commented 4 years ago

To add a ToC cell in the notebook, it is possible to use the toc2 extension via launching the classic notebook from JupyterLab. To add a ToC cell to the exported HTML, it is possible to use nbconvert with the html_toc extension format provided by the toc2 extension, so you don't need to open the classic notebook. I wrote more detailed about this in a SO answer.