Skip to content

Latest commit

 

History

History
19 lines (14 loc) · 514 Bytes

html_escape.md

File metadata and controls

19 lines (14 loc) · 514 Bytes

HTML Escape Normalizer

The html-escape normalizer uses html.EscapeString to escape special characters like "<" to become "<". It escapes only five such characters: <, >, &, ' and ".

type Comment struct {
  Body string `checkers:"html-escape"`
}

comment := &Comment{
  Body: "<tag> \"Checker\" & 'Library' </tag>",
}

checker.Check(comment)

// Outputs: 
// &lt;tag&gt; &#34;Checker&#34; &amp; &#39;Library&#39; &lt;/tag&gt;
fmt.Println(comment.Body)