1

I am working on a jinja2 template in python where autoescape=true flag is required due to privacy constraint. Since the autoescaping is enabled, jinja template ouputs the ascii value i.e >> instead of >> symbols.

Is their a way where I can still output the > sign while still enabling the autoescape flag?

item: abcd >> efgh

Sample Jinja2 template:

{{ item }} 

Current output: abcd >> efgh

Expected output: abcd >> efgh

Expected output: abcd >> efgh

Himanshu
  • 21
  • 1

1 Answers1

0

You can manually mark a specific variable as safe with the safe filter:

{{ item|safe }} 

But then you need to make sure that item does not contain any harmful content (replace them manually).

Dauros
  • 9,294
  • 2
  • 20
  • 28