637 B
637 B
HTML Unescape Normalizer
The html-unescape normalizer uses html.UnescapeString to unescape entities like "<" to become "<". It unescapes a larger range of entities than EscapeString escapes. For example, "á" unescapes to "á", as does "á" and "á".
type Comment struct {
Body string `checkers:"html-unescape"`
}
comment := &Comment{
Body: "<tag> "Checker" & 'Library' </tag>",
}
_, valid := checker.Check(comment)
if !valid {
t.Fail()
}
// Outputs:
// <tag> \"Checker\" & 'Library' </tag>
fmt.Println(comment.Body)