diff options
Diffstat (limited to 'docs/content/en/functions/transform/HTMLEscape.md')
-rw-r--r-- | docs/content/en/functions/transform/HTMLEscape.md | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/docs/content/en/functions/transform/HTMLEscape.md b/docs/content/en/functions/transform/HTMLEscape.md new file mode 100644 index 000000000..bb522769c --- /dev/null +++ b/docs/content/en/functions/transform/HTMLEscape.md @@ -0,0 +1,30 @@ +--- +title: transform.HTMLEscape +description: Returns the given string, escaping special characters by replacing them with HTML entities. +categories: [] +keywords: [] +action: + aliases: [htmlEscape] + related: + - functions/transform/HTMLUnescape + returnType: string + signatures: [transform.HTMLEscape INPUT] +aliases: [/functions/htmlescape] +--- + +The `transform.HTMLEscape` function escapes five special characters by replacing them with [HTML entities]: + +- `&` → `&` +- `<` → `<` +- `>` → `>` +- `'` → `'` +- `"` → `"` + +For example: + +```go-html-template +{{ htmlEscape "Lilo & Stitch" }} → Lilo & Stitch +{{ htmlEscape "7 > 6" }} → 7 > 6 +``` + +[html entities]: https://developer.mozilla.org/en-US/docs/Glossary/Entity |