Closed dnaka91 closed 1 year ago
Currently, I'm making pretty heaving use of heading attributes, to have custom fragment identifier for my headings.
Sadly, they're currently not handled by mdbook-toc, which causes wrong names in the generated table of contents.
I saw that the pulldown-cmark crate has support for this. The necessary steps are probably to add the Options::ENABLE_HEADING_ATTRIBUTES and then handle the Tag::Heading properly.
pulldown-cmark
The following allows me to have the same header names in different sections, and still have reasonable well named fragment anchors.
# My content ## A ### Schema {#a-schema} ## B ### Schema {#b-schema}
Then mdbook-toc includes those creating a ToC like this:
mdbook-toc
- [A](#a) - [Schema {#a-schema}](#schema-a-schema) - [B](#b) - [Schema {#b-schema}](#schema-b-schema)
What it should render, is the following
- [A](#a) - [Schema](#a-schema) - [B](#b) - [Schema](#b-schema)
Feel free to send a PR handling that.
Absolutely. Will prepare the changes in the coming days and send it your way 👍
Cool, I'll make sure to have some free cycles for review & merge then
Currently, I'm making pretty heaving use of heading attributes, to have custom fragment identifier for my headings.
Sadly, they're currently not handled by mdbook-toc, which causes wrong names in the generated table of contents.
I saw that the
pulldown-cmark
crate has support for this. The necessary steps are probably to add the Options::ENABLE_HEADING_ATTRIBUTES and then handle the Tag::Heading properly.Example
The following allows me to have the same header names in different sections, and still have reasonable well named fragment anchors.
Then
mdbook-toc
includes those creating a ToC like this:What it should render, is the following