Need to modify TOC list classes

I want to add classes in TOC list.

<li class="toc-level1">Main Heading</li>
<ul><li class="toc-level2"> Sub Heading 2 </li></ul>

How can I do that?

If you know regex you could try to wrap .TableOfContents and use replaceRE to modify it, but for now there’s no easy way to do it as far I know. (Another option could be target specific levels with CSS.)

There’s a stale PR that would allow you to roll your own:

1 Like