Documentation ¶
Overview ¶
Package bleach is a simple HTML sanitizer tool.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultPolicy = New( []*regexp.Regexp{ regexp.MustCompile(`^(class|style)$`), regexp.MustCompile(`^data-`), regexp.MustCompile(`^on[a-z]+`), regexp.MustCompile(`^(rel|srcset|sizes)$`), }, elementMap, )
DefaultPolicy is the default bleach policy.
Functions ¶
func SanitizeString ¶
SanitizeString replaces any control character in a string by a space.
Types ¶
type Policy ¶
type Policy struct {
// contains filtered or unexported fields
}
Policy holds the cleaning rules and provides methods to perform the DOM cleaning.
func (Policy) RemoveEmptyNodes ¶
RemoveEmptyNodes removes the nodes that are empty. empty means: no child nodes, no attributes and no text content.
func (Policy) SetLinkRel ¶
SetLinkRel adds a default "rel" attribute on all "a" tags.
Click to show internal directories.
Click to hide internal directories.