bookwyrm/bookwyrm/utils/sanitizer.py
Mouse Reeve 9d9b7f366a Use "strip" in bleach
This removes forbidden html, rather than leaving them in place but
unrendered.
2022-07-04 13:55:58 -07:00

27 lines
494 B
Python

"""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"],
strip=True,
)