jupyterlab-toc icon indicating copy to clipboard operation
jupyterlab-toc copied to clipboard

Insert TOC cell in notebook

Open pierreguilmin opened this issue 6 years ago • 5 comments

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.

pierreguilmin avatar Mar 27 '19 02:03 pierreguilmin

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.

maxpv avatar Jun 04 '19 12:06 maxpv

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

joelostblom avatar Jun 04 '19 21:06 joelostblom

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

lambdamusic avatar Jul 01 '19 08:07 lambdamusic

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

westurner avatar Nov 11 '19 05:11 westurner

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.

joelostblom avatar Dec 11 '19 12:12 joelostblom