Replies: 1 comment 1 reply
-
@bluebrown if an extra dependency is okay, I've extracted and generalized the code I use for this into an extension: goldmark-anchor. To use it, just add goldmark.New(
goldmark.WithParserOptions(
parser.WithAutoHeadingID(),
),
goldmark.WithExtensions(
// ...
&anchor.Extender{},
),
).Convert(src, out) The README has more instructions. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I would like to have some kind of link in the headers so that it will be easy to share a relevant section of the document.
There is an extension that generates Ids for headers but the Id alone is not all that useful. In order for it to become useful, there should be an anchors referencing to that section, preferable inside the header or wrapping it.
I could not find out how do achieve this. I think its a fairly common need and I am properly missing something in the docs.
Beta Was this translation helpful? Give feedback.
All reactions