Skip to content

Allow users to specify navigation depth for sidebar TOC tree in a clear way #566

Closed Answered by pradyunsg
orhanrauf asked this question in Ideas
Discussion options

You must be logged in to vote

As @sscherfke has helpfully pointed out, Sphinx supports limiting the depth of the page table of contents (i.e. right sidebar) out of the box, with :tocdepth: metadata in a file.

For reStructuredText source files, you can have the following at the top of your file:

:tocdepth: 5

For Markdown source files (using MyST-parser), you can have the following at the top of your file:

---
tocdepth: 5
---

(pick whatever number you want; I've arbitrarily shown 5)

The relevant section in Sphinx's documentation: https://www.sphinx-doc.org/en/master/usage/restructuredtext/field-lists.html#special-metadata-fields

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
1 reply
@orhanrauf
Comment options

Comment options

You must be logged in to vote
3 replies
@KasperLin
Comment options

@sscherfke
Comment options

@pradyunsg
Comment options

Comment options

You must be logged in to vote
2 replies
@KasperLin
Comment options

@pradyunsg
Comment options

Answer selected by pradyunsg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
needs info Needs information to reproduce/better understand the issue
4 participants