1def safe_clean(text):
2 from flask import Markup
3 from bleach import clean
4 tags = ['b','i','font','br']
5 attrs = {
6 '*':['style'],
7 'font':['color']
8 }
9 styles = ['color']
10 return Markup(clean(text,tags = tags,
11 attributes = attrs,
12 styles = styles))
自定义filter过滤器
知识共享署名-非商业性使用-相同方式共享4.0国际许可协议