transform.HTMLUnescape
Returns the given string, replacing each HTML entity with its corresponding character.
- Syntax
- transform.HTMLUnescape INPUT
- Returns
- string
- Alias
- htmlUnescape
Usage
The transform.HTMLUnescape function returns the given string, replacing each HTML entity with its corresponding character.
The function returns a string. Go’s html/template package escapes strings in most contexts, which escapes the unescaped characters in the result again. To render the result as is, pass it through the safe.HTML function.
Examples
{{ transform.HTMLUnescape "Lilo & Stitch" }} → Lilo & Stitch
{{ transform.HTMLUnescape "7 > 6" }} → 7 > 6Comparing the result with and without safe.HTML, showing the raw HTML output:
{{ transform.HTMLUnescape "Lilo & Stitch" }} → Lilo & Stitch
{{ transform.HTMLUnescape "Lilo & Stitch" | safeHTML }} → Lilo & StitchLast updated:
October 21, 2026
:
content: Apply style guide to transform functions (3625f720a)
Improve this page