Possible to add attribute to ToC links using replaceRE


Let say I have to add foo attribute to every link inside the ToC, my question is it possible to make it happend without using javascript?

my experiment is using replaceRE but the problem is i still have no idea how to make it work.

// maybe something like this
{{ .TableOfContents | replaceRE "<a>" "..." | safeHTML }}

Thank you

Yep this should work. For example:

{{ .TableOfContents | replaceRE "<a" "<a class=\"foo\"" | safeHTML }}

Awesome never thought that it would be so simple :grinning:

thanks a lot