I think that toc variable, unlike toctree ( https://www.sphinx-doc.org/en/master/templating.html#toctree), can't control its depth. They both generate <ul> list and one workaround I'm using is to hide deeper lists with CSS.
Have a look at this snippet https://codepen.io/mattdocumatt/pen/NWxrQqB that demonstrates it. Matt https://blog.documatt.com On Thu, May 14, 2020 at 9:03 AM Magic X <[email protected]> wrote: > Hi, > > I'm going to using the 'toc' variable in a html template to produce local > TOC for the current document in the sidebar, is it possible to control the > TOC max depth? > > -- > You received this message because you are subscribed to the Google Groups > "sphinx-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sphinx-users/828ac1c3-dc24-44f8-b851-a31d5c5d6654%40googlegroups.com > <https://groups.google.com/d/msgid/sphinx-users/828ac1c3-dc24-44f8-b851-a31d5c5d6654%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "sphinx-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/CAOGNDW-eTXCC3990q-khmNsRWdSQ5p9Wj%2B96MA0V854fDvP1-A%40mail.gmail.com.
