2

I have Flask-App and I have html page and i'm using jinja with it. I have a table, and this is a specific column in the table: {{ item["full_msg"] }}

item["full msg"] should be:

The
A
Team

(It contains "\n" after The, A, Team)

But it presents as:

The A Team

I've tried adding |safe - not working.

Tried adding multi line class like:

<td><div class="multiline">{{ item["full_msg"] }}</div></td>

Not working.

Looked at http://jinja.pocoo.org/docs/2.10/templates/#whitespace-control But didn't find solution to my problem.

Also tried:

                                <td><div class="multiline">{% autoescape false %}{{ item["full_msg"] }}{% endautoescape %}</div></td>

But no good.

What am I missing? Thanks

jonb
  • 845
  • 1
  • 13
  • 36

1 Answers1

0

Give Line breaks because html use line breaks instead \n

The </br>A </br>Team
aman5319
  • 662
  • 5
  • 16
  • Not working. The output is The A Team. It's not actually creating new line – jonb Jul 15 '18 at 12:52
  • need to pipe the result through safe in order for the
    tags to take effect. e.g. `{{ item.fullmessage | replace("\n", "
    " | safe ) }}`
    – James_SO Jul 22 '22 at 17:22