escape_xml
The escape_xml
filter converts special characters in a string to their corresponding XML entities, making the text safe for XML output. Here are the conversions available:
Character | Converts To |
---|---|
& |
& |
> |
> |
< |
< |
" |
" |
Input
1
{{ "This is a test &" | escape_xml }}
Output
1
This is a test &
Input
Type | Parameter | Description | Required |
---|---|---|---|
string | val | The string to escape. Comes before the | sign. | Required |
Output
Type | Description |
---|---|
string | The escaped string with XML entities |