Adding colors in the TOC of Jupyter Notebook 7

I previously used TOC2 in Jupyter 6 to apply different colors to my table of contents items, which made navigation much clearer.
However, this feature no longer seems to work in Jupyter 7, as it doesn’t appear to interpret markdown HTML commands within the table of contents correctly.
I explored using custom CSS, and while it successfully styles markdown headers in the main notebook window, it doesn’t affect the TOC.
If there any CSS keyword for headings TOC ? or other way of adding color for items in the TOC ?
My notebook is quite long, and adding color to the TOC would significantly improve clarity.

I don’t think this is limited to Jupyter Notebook 7.

I think given this currently still open issue report & this related one stating “With JupyterLab 4.2.0, when using markdown with html tags, the Table of Content display the full markdown code, including the html tags, instead of … displaying the markdown in the ToC with the correct format”, it is an ongoing situation/discussion.

Thank you. Is there a way of using the nbextension TOC2 then ? I can make it work with Jupyter Notebook 7.

I’m a little confused about what you are exactly asking here given the placement of the question mark.

None of the jupyter_contrib_nbextensions that work with Jupyter Notebook 6 (and earlier) will work in Jupyter Notebook 7 and up.

You can still use the jupyter_contrib_nbextensions with NbClassic.

You probably should read this answer here. The top part addresses, “Is there a way of using the nbextension TOC2”. And the bottom part touches on why jupyter_contrib_nbextensions won’t work with modern Jupyter interfaces.

You might want to consider putting in your input for what you need for the current Table of Content where I referenced in my first reply. I point that out because even if you switch to using NbClassic for now, the ability to use jupyter_contrib_nbextensions will be less and less of an option as the direction of development is not with that in mind.