jupyterlab-toc
jupyterlab-toc copied to clipboard
Ignore some generated headers in output cells, or collapse TOC entries
Thanks again for the update you made in #15 -- I regularly add to my TOC by displaying markdown snippets in my output cells.
However, I have recently come across the pandas-profiling module, which allows for the creating of a neat pd.DataFrame summary report (via pandas_profiling.ProfileReport(df)). This, however, creates a lot of top-level headings that end up getting captured by the TOC plugin.
So, for this feature request -- could we have any way to turn off the capturing of headings in certain output cells? Perhaps a right-click on the cell in question, with a menu item saying "ignore output in TOC", or something like that.
Alternatively, if the Headings in TOC themselves can be collapsed (a little different from #12, as this isn't collapsing the cell contents, but the TOC entry itself), this would probably be sufficient. Perhaps allow the highest level TOC entry to collapse to a "..." to conserve space, but still notify the user that there is something there, if they care to expand it.
And, once again, thank you for this great plugin!
Interesting, thanks for the info @kenjioman. cc @markellekelly and @zuoyuanh, something to consider in the work you are doing...
Why would cell output be considered part of the table of contents? Feels somewhat at odds with the plugin
@mlucool This was an early feature request for this extension (back when it was a lot simpler, I might add :) ), c.f. #15. The idea was to programmatically generate headers, possibly interpolating the contents of some kernel variables.
I'm don't think I agree that it is at odds with the plugin, generating headers with code seems like a reasonable thing to do. I do think we could expose an option so that users can choose whether they want to generate entries from code cell outputs.
The linked issue seems to imply one type of cell render (Markdown) and not all HTML should act as a TOC. Could we restrict this further in some way so that all HTML isn't picked up? Given the different usecases, the idea of a setting (per notebook? globally?) is a good option. Would it default on or off?
The collapse cell feature has some bugs with this. Try with this example:

https://github.com/jupyterlab/jupyterlab-toc/issues/54 may also be worth thinking about at the same time