How to set local TOC level?

64 views
Skip to first unread message

Magic X

unread,
May 14, 2020, 3:04:59 AM5/14/20
to sphinx-users
Hi,

I'm going to use 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?

Komiya Takeshi

unread,
May 14, 2020, 12:55:10 PM5/14/20
to sphinx...@googlegroups.com
Hi,

It seems no way to control it...

Thanks,
Takeshi KOMIYA

2020年5月14日(木) 16:05 Magic X <madj...@gmail.com>:
>
> Hi,
>
> I'm going to use 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 sphinx-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/4921d13b-6641-44dc-95f5-d21469189ec7%40googlegroups.com.

Magic X

unread,
May 22, 2020, 4:17:45 AM5/22/20
to sphinx-users
What a pity, it would be quite useful if this can be configured. I'am using the alabaster html and its localtoc.html template, does it mean that we have to write our own theme and extensions to control the local toc level?


On Friday, May 15, 2020 at 12:55:10 AM UTC+8, Komiya Takeshi wrote:
Hi,

It seems no way to control it...

Thanks,
Takeshi KOMIYA

2020年5月14日(木) 16:05 Magic X <madj...@gmail.com>:
>
> Hi,
>
> I'm going to use 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 sphinx...@googlegroups.com.

Magic X

unread,
Jun 19, 2020, 10:52:15 AM6/19/20
to sphinx-users
I've been found a way by myself, the ":docdepth:" metadata filed is dedicating to controlling local toc level. 

منصة شليله

unread,
Jun 19, 2020, 11:05:51 AM6/19/20
to sphinx...@googlegroups.com
[منصة شليله]
SA Riyadh 
51.36.196.174 
2020/06/19

[Pales help no English]

--
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 sphinx-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/5b0029e9-7eac-4b2f-bf59-8182f97d6276o%40googlegroups.com.

Aaron Carlisle

unread,
Jun 19, 2020, 8:37:13 PM6/19/20
to sphinx...@googlegroups.com
It would be nice to have this feature for templates.



--
Aaron Carlisle

Matt from Documatt

unread,
Jun 22, 2020, 8:50:40 AM6/22/20
to sphinx...@googlegroups.com
You already asked the same question on May 14. Correct? Copy & paste my answer:

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. 

Did it help you?

Matt

On Thu, May 14, 2020 at 9:05 AM Magic X <madj...@gmail.com> wrote:
Hi,

I'm going to use 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 sphinx-users...@googlegroups.com.

Daniel Scott

unread,
Nov 25, 2020, 10:39:48 PM11/25/20
to sphinx...@googlegroups.com
To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/a46209ec-d69c-4aaf-bd4a-1ca8f6088da8%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages