-1

I have a variable in my python flask application, which contains html data

html_data='<p> this data to be displayed </p>'

I have passed this variable in render_template(temp.html,data=html_data).

I need to display data variable in my temp.html, as HTML and not as string

I have tried {{ data }} it displays data as string and not HTML.

output: <p> this data to be displayed</p>' 

I want the above data to be displayed as HTML.

Thanks.

chowsai
  • 565
  • 3
  • 15

2 Answers2

3

Try using the below:

{{ data | safe }}
Hisagr
  • 601
  • 6
  • 13
1

I think u can try this, so that it wouldn't be escaped.

{{ data | safe }}
chowsai
  • 565
  • 3
  • 15