-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
Strikethrough in markdown heading triggers runtime error #11783
Comments
Configure the TOC (TableOfContents, toc.go) goldmark renderer to always enable the Strikethrough extension. This allows handling ast.KindStrikethrough within an AST node. Fixes gohugoio#7169 Fixes gohugoio#8087 Fixes gohugoio#11783
Whether you've configured taxonomies or are rendering a TOC is irrelevant. Simplest way to reproduce... put this in any markdown file:
It seems like the example above is unlikely to occur in the field, which is probably why this error hasn't shown up before. This isn't anything new. I can reproduce with v0.65.3 and later. This is not an upstream issue. Goldmark 1.6.0 handles this as expected, without error: func main() {
md := goldmark.New(
goldmark.WithExtensions(
extension.Strikethrough,
),
)
input := `
# [~~a~~](b)
`
var buf bytes.Buffer
if err := md.Convert([]byte(input), &buf); err != nil {
panic(err)
}
fmt.Println(buf.String())
} These examples do not trigger the error:
|
Thank you for simplifying the reproduction.
I wasn't able to reproduce without enabling taxonomies in my setup. Maybe
due to my theme.
…On Wed, Dec 6, 2023, 05:39 Joe Mooring ***@***.***> wrote:
Whether you've configured taxonomies or are rendering a TOC is irrelevant.
Simplest way to reproduce... put this in any markdown file:
# [~~a~~](b)
This is not an upstream issue. Goldmark 1.6.0 handles this as expected,
without error:
func main() {
md := goldmark.New(
goldmark.WithExtensions(
extension.Strikethrough,
),
)
input := `# [~~a~~](b)`
var buf bytes.Buffer
if err := md.Convert([]byte(input), &buf); err != nil {
panic(err)
}
fmt.Println(buf.String())
}
These examples do *not* trigger the error:
# ![~~a~~](b)
# ~~a~~
—
Reply to this email directly, view it on GitHub
<#11783 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEKSOJZ4J5K5TFJIYRSDFD3YH7ZG5AVCNFSM6AAAAABAIQD332VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBSGA3TGMZTG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I think the problem is that Still, I'd love to fix this issue in a forward oriented way (addressing all the linked issues) and without adding more complex logic to I didn't fully test the effect on the rendered TOC, yet. |
Configure the TOC (TableOfContents, toc.go) goldmark renderer to always enable the Strikethrough extension. This allows handling ast.KindStrikethrough within an AST node. Fixes gohugoio#7169 Fixes gohugoio#8087 Fixes gohugoio#11783
Configure the TOC (TableOfContents, toc.go) goldmark renderer to always enable the Strikethrough extension. This allows handling ast.KindStrikethrough within an AST node. The last test in TestEscapeToc() is corrected to not expect <div> elements to be included in the TOC renderer output. Fixes gohugoio#7169 Fixes gohugoio#8087 Fixes gohugoio#11783
Configure the TOC (TableOfContents, toc.go) goldmark renderer to always enable the Strikethrough extension. This allows handling ast.KindStrikethrough within an AST node. The last test in TestEscapeToc() is corrected to not expect <div> elements to be included in the TOC renderer output. Fixes gohugoio#7169 Fixes gohugoio#8087 Fixes gohugoio#11783
Configure the TOC (TableOfContents, toc.go) goldmark renderer to always enable the Strikethrough and Emoji extensions. This allows handling ast.KindStrikethrough and ast.KindEmoji AST nodes when rendering the TOC. Fixes gohugoio#7169 Fixes gohugoio#11783 Fixes gohugoio#12022
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
What version of Hugo are you using (
hugo version
)?Does this issue reproduce with the latest release?
Yes (also tested with current
master
).Summary
Hugo crashes with a similar message to
when these two conditions are true:
table of contents (TOC) is generated or taxonomies are configuredstrike-throughmarkupReproduction
The problem can easily be reproduced by cloning the following repo (instruction in README.md):
https://github.com/lyind/reproducer-2023-12-05
Notes
Possibly related to these auto-closed issues:
The text was updated successfully, but these errors were encountered: