Closed kaushalmodi closed 2 years ago
If implemented, please remember that there may be two or more fenced code blocks in the same document. That means that the id of the element wrapping the line number must be unique to the document, not just the code block in which it occurs. Perhaps two attributes: a boolean to enable/disable, and a string to prepend to the id.
@jmooring
Perhaps two attributes: a boolean to enable/disable, and a string to prepend to the id.
Just to clarify, those would be equivalent to the anchorlinenos
(boolean) and lineanchor
(string) in Hugo, right?
I want to make sure that this extension doesn't auto-generate an anchor prefix if the user provides one.
those would be equivalent to the anchorlinenos (boolean) and lineanchor (string)
Yes, but Hugo is just one of several projects that leverage yuin/goldmark and yuin/goldmark-highlighting. Implementation details need to be somewhat agnostic with respect to downstream projects.
Closing this issue here because the issue was apparently fixed in Hugo itself in https://github.com/gohugoio/hugo/commit/08fdca9d9365eaf1e496a12e2af5e18617bd0e66 .
Hello,
Can you please enable the support of
LinkableLineNumbers()
as supported by Chroma?https://github.com/alecthomas/chroma#the-html-formatter
Hugo supported enabling the generation of linkable line numbers by passing the
anchorlinenos=true
attribute to the Hugohighlight
shortcode. That shortcode internally uses the same Chroma library to do the code syntax highlighting.Right now, the
highlight
shortcode inherits thisanchorlinenos=true
feature from Chroma. But if I try to use code fences with that attribute, I do not get anchorized line numbers because this library doesn't support that.Thanks!
References