Almost identical to escape
, and you almost definitely want to use escape
instead.
Variable
shopping_list = '''Carrots
Honey
Milk
Butter'''
Template with force_escape
{% autoescape off %}
{{ shopping_list|linebreaks|force_escape }}
{% endautoescape %}
Result
<p>Carrots<br>Honey<br>Milk<br>Butter</p>
Template with escape
{% autoescape off %}
{{ shopping_list|linebreaks|escape }}
{% endautoescape %}
Result with escape
<p>Carrots<br>Honey<br>Milk<br>Butter</p>
Notice that the <br>
tags that are generated with the linebreaks
filter are escaped when force_escape
is used, but not when escape
is used.
Commentary
You are very unlikely to need this.