-
Notifications
You must be signed in to change notification settings - Fork 186
Open
Description
It would be helpful to have a hook to allow custom attribute filtering. I propose something much simpler than #24 that would integrate with the existing builder syntax:
// AttrTransform is a user provided function to manipulate the value
// of an attribute
type AttrTransform func(v string) string
func main() {
tf := func(v string) string {
return strings.ToUpper(v)
}
p := bluemonday.NewPolicy()
p.TransformAttrs(tf, "style").OnElements("div")
}
This would provide a convenient way to extend bluemonday without requiring the user to parse the HTML before or after calling Sanitize()
My goal is to implement CSS style attribute filtering for my project without forking bluemonday.
Metadata
Metadata
Assignees
Labels
No labels