martenframework / marten

The pragmatic web framework.
https://martenframework.com
MIT License
405 stars 23 forks source link

Add autoescape template tag #142

Closed ellmetha closed 3 months ago

ellmetha commented 8 months ago

Description

Let's introduce an autoescape template tag that will allow to control whether auto-escaping is enabled or disabled within a specific template block. This template tag would work as follows:

{% autoescape on %}
<!-- Auto-escaping is enabled -->
{% endautoescape %}

{% autoescape off %}
<!-- Auto-escaping is disabled -->
{% endautoescape %}

Coupled with the use of the escape template filter, this new template tag would allow to better accommodate situations where it's required to manually control what gets escaped versus what's not.