在Jinja上保留\ n

时间:2018-07-15 12:35:42

标签: html css flask jinja2

我有Flask-App,并且我有html页面,并且我正在使用jinja。 我有一个表,这是表中的特定列:                                 {{item [“ full_msg”]}}

item [“ full msg”]应该为:

The
A
Team

((在The,A,Team之后包含“ \ n”)

但是它表示为:

The A Team

我尝试添加| safe-不起作用。

试图添加多行类,例如:

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

不起作用。

查看了http://jinja.pocoo.org/docs/2.10/templates/#whitespace-control 但是没有找到解决我问题的方法。

也尝试过:

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

但是不好。

我想念什么?谢谢

1 个答案:

答案 0 :(得分:0)

给定换行符,因为html使用换行符代替\ n

The </br>A </br>Team
相关问题