Parses HTML code and outputs without escape

How to not escape HTML code in Anqi CMS template, but parse output?

safeThe filter can cancel the default escape attributes of the template output, allowing the html code to be directly output to the interface, and allowing the browser to parse the HTML code. It is generally used in rich text output, such as displaying article details, etc.

Note: UsesafeFilter, by default, thinks your output is safe, it won't escape special characters, so if the code contains problems such as xss injection, it will also output as is. Please be careful to prevent risks.

How to use

safeHow to use filters:

{{ obj|safe }}

For example<script>Keep the output without escaping, you can write it like this:

{{ "<script>"|safe }}
# Show results
<script>

Sample Demo

{{ "<script>"|safe|escape }}
{{ "<script>"|safe|e }}

Show results

<script>
<script>