transform.Plainify
Returns the given input with all HTML tags removed.
- Syntax
- transform.Plainify INPUT
- Returns
- any
- Alias
- plainify
Usage
The transform.Plainify function returns the given input with all HTML tags removed.
The return type depends on the type of INPUT. If INPUT is of type template.HTML, the function returns template.HTML. Otherwise, it returns a string.
When you print a string result in an HTML template, Hugo escapes HTML entities in the result again. To prevent this, pass a template.HTML value as INPUT, such as the result of the safe.HTML function. See safe types for details.
Examples
{{ transform.Plainify "<b>BatMan</b>" }} → BatManComparing string and template.HTML input, showing the raw HTML output:
{{ "<b>Lilo & Stitch</b>" | transform.Plainify }} → Lilo &amp; Stitch
{{ "<b>Lilo & Stitch</b>" | safeHTML | transform.Plainify }} → Lilo & Stitch