New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
config to control the toc depth for a page and/or project #10935
Comments
@tk0miya / @AA-Turner - thoughts on this? I'm happy to do the work for a PR if it's likely to be merged. Just hit this again on https://sybil.readthedocs.io/en/latest/api.html where the right nav is also becoming unusable: I want to list functions, module-level attributes and classes in the right nav, but not class attributes or methods. |
We would love this feature too! Our API reference page has an unusably large right nav, but we really don't need the L3 items, and they are already grouped nicely. |
@yuvaltassa - you can turn them off completely, but certainly for my case, I want the top-level ones to be there (mainly classes, sometimes function or module-level variables) just not methods or attributes of classes. |
Sorry, by "we really don't need the L3 items", I meant that we would like to turn off TOC indexing for items with |
No, the |
@cjw296, if you get around to writing that PR, we'd love to help you test it 🙂 |
This might be a theme-related setting. Sphinx's built-in themes already provide a I think this should be a feature request for the |
There might be one thing for Sphinx to do though: AFAICT, currently the |
@mgeier - not sure I agree, this code is under recent development, see 650f63b from Sept 2022. We have a It may even be sufficient to just have a "toc_object_no_class_members" setting, which would certainly give me what I need. Would be helpful to have @AA-Turner's thoughts on this... |
You don't have to, but maybe I can clarify a bit: My comments were in response to the issue title "config to control the toc depth for a page and/or project": such a control already exists in the built-in themes ( The top comment then bring another idea into play: "I would have preferred to include class names, but not methods within those classes." In this case I agree, this could also something that sphinx could provide. However, those are two orthogonal settings and should not be conflated. To recap: there are three potential ways to influence the appearance of TOC levels:
The first two specify an explicit "depth", the third only indirectly affects the TOC depth. |
Right, so it seems I have two potential feature requests for Sphinx:
I'd have a preference for the second one, I guess we wait to hear from @AA-Turner before I do any PR work... |
I think you're misunderstanding what this request is about. This user is asking for a limit on |
@pradyunsg - right, that's what I thought, so I guess the subject for this feature request is correct and remains the way forward: domain objects were only added to the So it seems we're back to:
I'm fine with either, and happy to do the work for the PR, but will wait to hear from folks if it's a thing that's likely to be merged, preferably in the 5.x line of Sphinx... |
fwiw, came across this while googling, not sure why it wasn't mentioned but within a page you can control the depth of the in-page toc by using |
Is your feature request related to a problem? Please describe.
From pradyunsg/furo#557:
For one of my projects, the right nav for the API reference has become unusable: it lists sections in the .rst file, then class names, then methods on those classes, all in the right nav.
Describe the solution you'd like
What I'd like to do is limit the depth on the right name, so only the section heading and class names are shown.
Describe alternatives you've considered
toc_object_entries
worked in this case but it's a shame it's a boolean rather than a depth: I would have preferred to include class names, but not methods within those classes.The text was updated successfully, but these errors were encountered: