escape
Escape HTML special characters such as &, <, >, and " into safe HTML entities.
Syntax
{{ html_string | escape }}Example
{% assign tag = "<div>Featured</div>" %}{{ tag | escape }}Output
&lt;div&gt;Featured&lt;/div&gt;The escape filter converts HTML reserved characters (&, <, >, and ") into their corresponding entity representations (&, <, >, "), preventing browsers from rendering them as active markup.
In programmatic keyword generation, escape secures pages against accidental markup injection from third-party vendor CSV feeds. For example: {{ row.customer_quote | escape }}. This prevents broken layout hierarchies or unintended tag closures if an attribute contains angle brackets or raw quotes, ensuring valid HTML output.
Filters
- abs
- append
- at_least
- at_most
- capitalize
- ceil
- compact
- concat
- date
- default
- divided_by
- downcase
- escape
- escape_once
- first
- floor
- join
- last
- lstrip
- map
- minus
- modulo
- newline_to_br
- plus
- prepend
- remove
- remove_first
- replace
- replace_first
- reverse
- round
- rstrip
- size
- slice
- sort
- sort_natural
- split
- strip
- strip_html
- strip_newlines
- times
- truncate
- truncatewords
- uniq
- upcase
- url_decode
- url_encode
- where
- raw
- slugify
- number_format
