mkdocs-material
mkdocs-material copied to clipboard
Insiders tag plugin conflicts with markdown_extensions.toc
Context
The new Insiders tag plugin rewrite conflicts with the markdown_extensions.toc
extension.
Bug description
When the markdown_extensions.toc
extension is used and toc_depth
option is set to a value <6, the new Insiders tag plugin doesn't generate tag listings.
Related links
Reproduction
9.5.23+insiders.4.53.8-no-tags-list-with-toc.zip
Steps to reproduce
- enable
plugins.tags
inmkdocs.yml
- set
markdown_extensions.tac.toc_depth: 6
inmkdocs.yml
-
<!-- material/tags -->
doesn't generate anything
Browser
No response
Before submitting
- [X] I have read and followed the bug reporting guidelines.
- [X] I have attached links to the documentation, and possibly related issues and discussions.
- [X] I assure that I have removed all customizations before submitting this bug report.
- [X] I have attached a .zip file with a minimal reproduction using the built-in info plugin.
Thanks for reporting! Fixed in 0f167caf4
. The problem is that the tags plugin needs to somehow hook into the TOC generation, and it does so by just appending the maximum headline, so the tags listing is listed under the preceding headline. This is a pretty dirty hack, but otherwise, it would be much more difficult to pull this off, as we'd need to parse the Markdown again, and isolate which was the last headline before the tags listing.
When the maximum level is changed, it stops as reported. Now, the plugin will read the maximum level from the configuration of the table of contents extension and use that for injecting listings.
Is that the optimal solution? Very far from it, but we need to work with what Python Markdown and MkDocs gives us. We'll investigate in the future if we can improve the implementation and make it less hacky. I hope that in the meantime, the reported problem can be considered fixed.
Thank you for the quick fix! Much appreciated.
I can confirm that this commit resolves the issue for us, so closing this issue now.
Great! Keeping open until released.
Released as part of 9.5.24+insiders-4.53.9.