Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SanitizeHTMLDocument ¶ added in v0.6.0
SanitizeHTMLDocument sanitizes an HTML document body using the permissive HTML document policy. The iframeAllowlist controls which domains are allowed in iframe src attributes.
func ValidateHTMLDocument ¶ added in v0.6.0
ValidateHTMLDocument validates that the HTML document is non-empty and does not contain script tags or event handler attributes. It returns an error if the document is invalid.
func ValidateTipTapDocument ¶
Types ¶
type Sanitizer ¶
type Sanitizer struct {
// contains filtered or unexported fields
}
func NewSanitizer ¶
func NewSanitizer() *Sanitizer
func (Sanitizer) ContainsHTML ¶
ContainsHTML reports whether value contains an actual HTML tag (an opening "<" immediately followed by a tag-name letter, a "/" for closing tags, or a "!" for comments/DOCTYPE). It deliberately does NOT treat a bare "&" or a straight "'" as HTML: bluemonday's strict policy escapes those to "&"/"'", so a previous "did the sanitizer change the input?" heuristic false-positived on real titles like "Install & first content" or "roaster's". Plain text that merely contains an ampersand, an apostrophe, or a math "<" is left alone.