Open lambdamusic opened 5 years ago
You mean that your ToC on one webpage/tab contains items from other notebooks you have open in other tabs? That’s bizarre. I haven’t used the notebook for years - before it was jupyter - so I’m not sure what’s going on.
Maybe modifying the selector? Currently it’s set to ‘:header’.
Also it would be easy to update the code to not use JQuery.
Bringing up an old thread, but just wanted to comment that the above solution posted by @lambdamusic has worked well for me.
I did get the same issue that they noted (headers from all the notebooks I have open (in different tabs) are meshed together), or something similar - but I found that when I exported the notebook as .html this issue was not there - it only contained the headings from my notebook. For me, this is the desired function so I'm happy with it.
I would recommend moving @lambdamusic 's solution into the README file with a notice to Jupyter Lab users, as this getting more popular than Notebook.
Unfortunately this doesn't work out of the box with jupyterlab (see https://github.com/jupyterlab/jupyterlab/issues/1818).
I managed go get the script to load by first loading jquery like this
And then
However the TOC is not correct. The markdown headers from all the notebooks I have open (in different tabs) are meshed together.
Haven't had time to debug it properly.. maybe you have some ideas though :-)