19 lines
315 B
Go
19 lines
315 B
Go
|
package koushinbase
|
||
|
|
||
|
import (
|
||
|
"github.com/microcosm-cc/bluemonday"
|
||
|
)
|
||
|
|
||
|
func sanitizeHTML(b string) string {
|
||
|
p := bluemonday.UGCPolicy()
|
||
|
|
||
|
// TODO: be more strict
|
||
|
p.AllowElements("style")
|
||
|
p.AllowAttrs("style")
|
||
|
|
||
|
p.AddTargetBlankToFullyQualifiedLinks(true)
|
||
|
p.RequireNoFollowOnLinks(true)
|
||
|
|
||
|
return p.Sanitize(b)
|
||
|
}
|