Sometimes, we want to pass HTML to template using Python Flask and Jinja2.
In this article, we’ll look at how to pass HTML to template using Python Flask and Jinja2.
How to pass HTML to template using Python Flask and Jinja2?
To pass HTML to template using Python Flask and Jinja2, we can use the safe filter.
For instance, we write
{{ something|safe }}
to render something string as HTML by using the safe filter.
Conclusion
To pass HTML to template using Python Flask and Jinja2, we can use the safe filter.