<分区>
<分区>
我有 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>
但是不好。
我错过了什么?谢谢
最佳答案
给出换行符,因为 html 使用换行符代替\n
The </br>A </br>Team
关于html - 在神社上保留\n,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51348431/