扫码关注官方订阅号
Flask 的模板 Jinja2 会将所有的 html 转义,我想让输出的 <img>、<code> 等指定的标签不进行转义,让他们正常输出,有何良策?
<img>
<code>
闭关修行中......
可以试试 safe 这个filter,原始的 string 就不会被 escape
safe
filter
string
escape
{{ some html string|safe }}
feedparser 里有 HTML sanitization 功能。
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
可以试试
safe这个filter,原始的string就不会被escapefeedparser 里有 HTML sanitization 功能。