render html strings in flask templates render html strings in flask templates flask flask

render html strings in flask templates


by default jinja2 (the template engine for flask) assumes input inside of {{ }} is unsafe and will not allow js or html inside of them ... you can solve this by using the safe filter inside your template. this will tell jinja2 that the content is safe to render as is, and not to escape the html/javascript

{{ post.body | safe }}