Skip to content

Commit d9bd171

Browse files
mruegCopilot
andcommitted
fix: support custom anchor IDs in headings ({#my-anchor} syntax)
Add parser.WithAttribute() to the goldmark parser options so that extended Markdown heading attributes like {#custom-id} are parsed correctly instead of appearing as literal text in the heading. Before: # My Heading {#custom-id} → <h1>My Heading {#custom-id}</h1> After: # My Heading {#custom-id} → <h1 id="custom-id">My Heading</h1> Fixes #519 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ac26421 commit d9bd171

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

markdown/markdown.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ func compileMarkdownWithExtension(markdown []byte, ext goldmark.Extender, logMes
109109
),
110110
goldmark.WithParserOptions(
111111
parser.WithAutoHeadingID(),
112+
parser.WithAttribute(),
112113
),
113114
goldmark.WithRendererOptions(
114115
html.WithUnsafe(),

0 commit comments

Comments
 (0)