Documentation ¶
Overview ¶
Package html provides functions for escaping HTML and for parsing and replacing HTML entities.
Index ¶
Examples ¶
Constants ¶
View Source
const BadEntity = string(utf8.RuneError)
Variables ¶
This section is empty.
Functions ¶
func EscapeString ¶
Example ¶
fmt.Println(EscapeString(`<a href="https://www.google.com/search?q=something&ie=utf-8">Google Search</a>`))
Output: <a href="https://www.google.com/search?q=something&ie=utf-8">Google Search</a>
func ParseEntity ¶
Example ¶
fmt.Println(ParseEntity(""")) fmt.Println(ParseEntity(""")) fmt.Println(ParseEntity(""")) fmt.Println(ParseEntity(""")) fmt.Println(ParseEntity(""")) fmt.Println(ParseEntity(""")) fmt.Println(ParseEntity(""")) fmt.Println(ParseEntity("�"))
Output: " 6 " 6 " 5 " 12 " 11 0 0 � 11
func ReplaceEntities ¶
Example ¶
fmt.Println(ReplaceEntities(" & © Æ Ď ¾ ℋ ⅆ ∲ # Ӓ Ϡ � " ആ ಫ   &x; &#; &#x; &ThisIsWayTooLongToBeAnEntityIsntIt; &hi?; © &MadeUpEntity;"))
Output: & © Æ Ď ¾ ℋ ⅆ ∲ # Ӓ Ϡ � " ആ ಫ   &x; &#; &#x; &ThisIsWayTooLongToBeAnEntityIsntIt; &hi?; © &MadeUpEntity;
func WriteEscapedString ¶
Example ¶
var buf bytes.Buffer WriteEscapedString(&buf, `<a href="https://www.google.com/search?q=something&ie=utf-8">Google Search</a>`) fmt.Println(buf.String())
Output: <a href="https://www.google.com/search?q=something&ie=utf-8">Google Search</a>
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.