Introduction

The escape filter is used to convert special characters in a string to their equivalent text entities. This is useful to ensure that the content displayed in text messages is safe and properly formatted without interpreting special characters.

Example of use

Example of how to use the escape filter to ensure special characters in a string are displayed correctly:

{{ '<p>Hello, this is a <em>test</em> message</p>'|escape }}

Example output of the code: