Adding target="_blank" to User-Generated HTML Anchors in Go

from blog Blog on hjr265.me, | ↗ original
Working with user-generated content is always a nightmare interesting. Let’s say you are building a blogging platform with Go. Your users write posts in Markdown that the platform then renders as HTML. And, you want to add target="_blank" and rel="noreferrer noopener" to all the external links. How do you do that? Annotated Code The steps are...