ollien ollien - 1 year ago 104
Python Question

New lines in flask within {%block content%}

So if I were to do something like

{% block content %}
{% endblock %}

in my HTML, and
is equal to
"Test <br /> test2"
how come the
prints out and does not make a new line? is there a way to fix this?

Answer Source

Jinja2 automatically escapes special characters for you. Probably simplest way is to use safe filter:

{{ variable|safe }}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download