ckeditor提交的文本如何在前台正确显示(去除html标签)(python、flask)
本文介绍了ckeditor提交的文本如何在前台正确显示(去除html标签)(python、flask)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
用flask集成ckeditor进行文本编辑后,首页的文本显示中带有html标签,请问这个标签要如何去除?
谢谢~
<ul class="posts">
{% for post in posts %}
<div class="post-content">
<div class="post-header">
<a href="{{ url_for('.post', id=post.id) }}">
{{ post.article_name }}
</a>
</div>
<div class="post-body">
<pre>{{ post.body }}</pre>
</div>
<div class="post-footer">
{% if current_user == post.author %}
<a href="{{ url_for('.edit_post', id=post.id) }}">
<span class="label label-primary">Edit</span>
</a>
{% endif %}
</div>
</div>
</li>
{% endfor %}
</ul>
解决方案
jinja2不转义使用{{ var|safe}}
这篇关于ckeditor提交的文本如何在前台正确显示(去除html标签)(python、flask)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文