aboutsummaryrefslogblamecommitdiff
path: root/plugins/base/sanitize_html.go
blob: 830f7a76421be6a33960f6f3220c156d59ea5f1a (plain) (tree)
1
2
3
4
5
6
7





                                            
                                    








                                                   
                                 
 
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)
}