I have some data in jinja2 like this
'item1|item2|item3'
And I want to turn it into rendered linebreaks. However, when I replace it with br/ tags, I get the br tags rendered on the page. So
{{ 'item1|item2|item3' | replace("|", "<br/>") }}
renders as
item1<br/>item2<br/>item3<br/>
When I want
item1 item2 item3
on my page. I feel like I'm missing some obvious trick here...
This has to do with autoescaping. Solution that worked for me was:
{% autoescape false %} {{ 'item1|item2|item3' | replace("|", "<br/>") }} {% endautoescape %}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With