0

I try to return html code as variable. What am I doing wrong?

python: return render_template("dashboard.html", services = "<h1>Service 1</h1>") html: Your services: {{services}}

But it gives the services value as text: Your services: <h1>Service 1</h1>"

Ami Hollander
  • 2,435
  • 3
  • 29
  • 47
Joachim
  • 13
  • 3

1 Answers1

0

Seems your Jinja2 is in automatic escaping mode. You need to mark your string as "safe" so that it won't be escaped:

{{services|safe}}

Read more at Jinja2 docs.

Amadan
  • 191,408
  • 23
  • 240
  • 301