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
TOC does not list all h1 & children elements #818
Comments
The TOC is not intended to list Valid structures for Markdown documents used with Material are:
or (omitting
|
Thanks for you reply, I didn't know that but it does makes sense to allow only a single h1. It however upsets pandoc docx to md output because those md's can include multiple h1 elements depending on converted docx & the titles used etc. Adhering to spec this way is confusing and could maybe be catched more elegantly in toc.html with a warning message about the parsed md file containing multiple h1 elements, ignoring them makes it look broken. |
Yes, you're correct, a warning would be awesome. However, the Jinja runtime is very, very limited and it's not possible for a template to emit a warning. |
Closing as answered |
I have some doubts on how this works, considering that using default MkDocs theme displays all h1 and h2 headers in the Toc, so at least MkDocs sees it as valid? |
This is a deliberate design decision. Material only supports a single |
Table of contents now builds correctly: squidfunk/mkdocs-material#818
Description
TOC only lists first h1 parent's children.
Expected behavior
TOC displays all h1 and children elements.
Actual behavior
TOC only displays the first h1 parent's children
Steps to reproduce the bug
Create a md page with:
Visit the page and the TOC will show:
It should show:
The problem seems to come from toc.html where toc_ gets populated with the first parent children elements hence it will not show the first h1 element itself but only children elements of the first h1 parent.
When creating a partial overwrite and removing the if/endif the TOC shows all h1 & children from the md.
Package versions
Project configuration
Not relevant
System information
Not relevant
The text was updated successfully, but these errors were encountered: