-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Can't hide ToC if it's integrated in navigation #2162
Comments
Thanks for reporting. However, this is working as intended, as the |
Closing for housekeeping. If you want to replicate this behavior, you may use inline CSS to hide the table of contents in the sidebar: <style>
.md-nav--primary .md-nav__link[for=__toc] ~ .md-nav {
display: none;
}
</style> |
Also need this. +1 |
I think the custom style for hiding the table of contents in the drawer needs to be extended just a little to also hide the icon: <style>
+ .md-nav--primary .md-nav__link[for=__toc] > .md-nav__icon,
.md-nav--primary .md-nav__link[for=__toc] ~ .md-nav {
display: none;
}
</style> |
This seems to hide the TOC altogether, instead of just when
is part of the file. I would like to the integrated TOC to respect the per-file setting. |
As squidfunk mentioned, this essentially works as intended and documented. That would suggest a customization. However, such a step would solve the issue only for desktop users and would leave the ToC in the mobile navigation. Can you do me the favor and describe the use case that gives rise to this question? I am asking because I would like to understand if this should be made configurable in the future or if this should really be solved in a different manner (splitting up overly long pages, for example). |
Oh in my case I would like to hide the TOC on pages that only have one or two headings, because it adds to much visual clutter. |
It should be possible to achieve what you are looking for by overriding the Another approach would be to take the CSS discussed above and include it in the page when |
Thanks! I didn't know it was possible to have custom CSS based on the YAML frontmatter... I should look into that. |
You would need to write a hook to implement this logic. |
I've found a bug and checked that ...
Description
When using the
toc.integrate
feature flag, the Table of Contents can't be hidden per-file using metadata. However, it does work flawlessly without the feature.Expected behavior
Hiding the ToC on metadata prevents it from appearing in that page, no matter if
toc.integrate
is being used.Actual behavior
Hiding the ToC on metadata prevents it from appearing, only if
toc.integrate
is not being used.Pictures
Here you have a couple screenshots, both showing the metadata of the test file and the state of the feature.
Steps to reproduce the bug
mkdocs.yml
.Package versions
Project configuration
System information
The text was updated successfully, but these errors were encountered: