yuin / goldmark

:trophy: A markdown parser written in Go. Easy to extend, standard(CommonMark) compliant, well structured.
MIT License
3.68k stars 255 forks source link

What is the best way to add target & other attributes to anchors? #160

Closed jjude closed 3 years ago

jjude commented 3 years ago

This is not an issue but question. I want to add target="_blank" and utm (marketing) strings to all anchor links in a markdown. What is the best way to achieve this? Are there any examples?

I looked into both AST & parser. Not sure if this needs to be done in parser or in AST. Any pointers to start will help.

Thanks.

yuin commented 3 years ago

ASTTransformer should do the job. Example: gitea

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.