1
0
Fork 0

Uses library for html cleanup

This commit is contained in:
Mouse Reeve 2022-07-04 13:14:22 -07:00
parent 58b23a74da
commit 7f78140015
6 changed files with 44 additions and 102 deletions

View file

@ -0,0 +1,25 @@
"""Clean user-provided text"""
import bleach
def clean(input_text):
"""Run through "bleach" """
return bleach.clean(
input_text,
tags=[
"p",
"blockquote",
"br",
"b",
"i",
"strong",
"em",
"pre",
"a",
"span",
"ul",
"ol",
"li",
],
attributes=["href", "rel", "src", "alt"],
)