sanitize Modifier

Convert special characters to HTML entities with htmlspecialchars.

example: <b>NEAT</b>
yaml
{{ example | sanitize }}
antlers
&lt;b&gt;NEAT&lt;b&gt;
html

Double Encoding#

You can double encode HTML entities by passing true as an argument. This is useful for preserving JSON formatting.

{{ example | sanitize(true) }}
antlers
Docs feedback

Submit improvements, related content, or suggestions through Github.

Betterify this page →