alps/plugins/base/sanitize_html.go
2020-01-20 16:20:16 +01:00

19 lines
320 B
Go

package koushinbase
import (
"github.com/microcosm-cc/bluemonday"
)
func sanitizeHTML(b []byte) []byte {
p := bluemonday.UGCPolicy()
// TODO: be more strict
p.AllowElements("style")
p.AllowAttrs("style")
p.AddTargetBlankToFullyQualifiedLinks(true)
p.RequireNoFollowOnLinks(true)
return p.SanitizeBytes(b)
}