Collapsible Table of Content (TOC)?

Does XWiki somehow support collapsible Table of Contents (TOC) ?

I have some very long pages, with a lot of headers of different levels, going sometimes as deep as level 5 or 6. That makes a very long TOC. Of course I could limit my TOC level to say 1 or 2, but I like to have all my headers in the TOC, including the low level ones.

Ideally, I’d like to see a TOC expanded to the first or maybe the second level, and clicking on a header expands the headers below it (e.g, levels 3 to 6). With maybe a “collapse all” and a “expand all” button.

This could be accomplished with a bit of javascript, css and jquery.

See this page for an example implementation: https://forscientia.com/examples/collapsable.html. The individual directory entries are collapsable Just view source to see how it is done using styles.

It’s a pretty simple implementation, but I was only looking for something quick to implement.

Thanks, I’ll have a look into it