Skip to content
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

Insiders tag plugin conflicts with markdown_extensions.toc #7191

Closed
4 tasks done
kcgthb opened this issue May 17, 2024 · 5 comments
Closed
4 tasks done

Insiders tag plugin conflicts with markdown_extensions.toc #7191

kcgthb opened this issue May 17, 2024 · 5 comments
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open

Comments

@kcgthb
Copy link
Contributor

kcgthb commented May 17, 2024

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

  1. enable plugins.tags in mkdocs.yml
  2. set markdown_extensions.tac.toc_depth: 6 in mkdocs.yml
  3. <!-- material/tags --> doesn't generate anything

Browser

No response

Before submitting

@squidfunk squidfunk added the bug Issue reports a bug label May 17, 2024
@squidfunk
Copy link
Owner

squidfunk commented May 17, 2024

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.

@squidfunk squidfunk added the resolved Issue is resolved, yet unreleased if open label May 17, 2024
@kcgthb
Copy link
Contributor Author

kcgthb commented May 17, 2024

Thank you for the quick fix! Much appreciated.

@kcgthb
Copy link
Contributor Author

kcgthb commented May 17, 2024

I can confirm that this commit resolves the issue for us, so closing this issue now.

@kcgthb kcgthb closed this as completed May 17, 2024
@squidfunk
Copy link
Owner

Great! Keeping open until released.

@squidfunk squidfunk reopened this May 18, 2024
@squidfunk
Copy link
Owner

Released as part of 9.5.24+insiders-4.53.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open
Projects
None yet
Development

No branches or pull requests

2 participants