自定义jinja2转义标签


参考问题
参考资料
最终代码:

def safe_clean(text):
    from flask import Markup
    from bleach import clean
    tags = ['b','i','font','br']
    attrs = {
        '*':['style'],
        'font':['color']
    }
    styles = ['color']
    return Markup(clean(text,tags = tags,
                        attributes = attrs,
                        styles = styles))

自定义filter过滤器

Author: honmaple

NO CONTENTS

lin.jiang

风落花语风落天,花落风雨花落田.