Closed 40huo closed 6 years ago
You can try with this CSS (it doesn't work exactly like your example, but it's close):
:not([data-md-state="blur"]) + nav {
display: none;
}
This is an enhancement and could be done with the collapsing logic of the navigation. It could be set via flag in the configuration. I may implement it in the future when I find the time.
I'm closing this, as this will probably never get implemented. Material's default behavior should work pretty good, but it can also be extended by custom JavaScript. Giving users the option to auto-collapse the TOC is too specific to be useful. I want to allocate my time to stuff that needs to be fixed, not optional "nice" features. I'm sorry and hope you can understand.
We've recently ran into this issue as well where it would have been perfect if this feature was available.
Our case was specifically because we are using mkdocstrings
and documenting a Python package with many submodules. This means that breaking this up into multiple files requires refactoring of the codebase which is not ideal.
One of the submodules (__init__.py
) is quite large and requires a lot of scrolling on the left until you can review the next submodule.
Thanks for the feedback. I'll might consider adding this in the future.
Np, but most of all... Thank you for all your hard work on this! Happy to be a supporter in mkdocs-material-insiders.
Just for the records (in case it changes the consideration about implementing this), I'm also having this problem when using mkdocstrings
(using show_category_heading: true
in particular).
It would be really nice to present a collapsed TOC where you can click on the "category" you are interested in (like "Classes") and then look for some and click on it, and the look for a method for example. It also makes a very good way to have a quick overview on some module, for example if you want to see a list of classes, or functions.
Exactly the same as with the nav bar, where I can see a very nice overview of the packages and modules available at different nesting levels.
Here is an example of how nice and useful the nav bar looks:
And here how hard it is to have an overview of which classes are available in a particular module:
BTW, I tried the solution proposed in:
But it didn't work, if anyone have any ideas on how to hack the TOC to make it collapsible, it would be highly appreciated!
Thanks for your feedback. As said in https://github.com/squidfunk/mkdocs-material/issues/695#issuecomment-1263699535, we might reconsider adding this feature in the future.
When a single markdown file contains too many headers, like this one, the TOC is too long.
In this case, an auto-expand TOC may be more readable, like auto-expand TOC example, which uses hexo-theme-indigo.