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

Honor the Hugo Goldmark Extras extension when rendering TOC entries #12605

Open
jmooring opened this issue Jun 17, 2024 · 1 comment
Open

Honor the Hugo Goldmark Extras extension when rendering TOC entries #12605

jmooring opened this issue Jun 17, 2024 · 1 comment

Comments

@jmooring
Copy link
Member

Low priority.

Site configuration

[markup.goldmark.extensions]
strikethrough = false

[markup.goldmark.extensions.extras.delete]
enable = true

[markup.goldmark.extensions.extras.insert]
enable = true

[markup.goldmark.extensions.extras.mark]
enable = true

[markup.goldmark.extensions.extras.subscript]
enable = true

[markup.goldmark.extensions.extras.superscript]
enable = true

Markdown

## Hydrogen (H) is the 1^st^ element in the periodic table

## Water (H~2~O) is a liquid

## Water (H~2~O) is a ~~liquid~~ ++compound++

## Water (H~2~O) is an ==organic compound==

Actual TOC

image

Desired TOC

image

@bep bep added this to the v0.128.0 milestone Jun 20, 2024
@bep bep modified the milestones: v0.128.0, v0.129.0 Jun 21, 2024
@bep bep modified the milestones: v0.129.0, v0.131.0 Jul 22, 2024
@bep bep modified the milestones: v0.131.0, v0.133.0 Aug 9, 2024
@bep bep modified the milestones: v0.133.0, Unscheduled Aug 29, 2024
@jerrychan7
Copy link

For anyone who needs this functionality, I wrote a template library that generates a ToC. https://github.com/jerrychan7/hugoPerfectToC
This project can correctly generate the table of contents, but the disadvantage is that the performance is relatively poor.
Since the project parses HTML, it can theoretically parse any extension correctly. Or work with the heading rendering hook.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants