summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorAndrew Godwin2022-11-21 21:18:13 -0700
committerAndrew Godwin2022-11-21 21:18:13 -0700
commit53d94529175dface366a935eea2c2bcc1eeab15c (patch)
tree169575fc31d532fdb31a924636fc535c55c60df4 /core
parenta80e0f117a0271d428abd939e2896857a8da1b5c (diff)
downloadtakahe-53d94529175dface366a935eea2c2bcc1eeab15c.tar.gz
takahe-53d94529175dface366a935eea2c2bcc1eeab15c.tar.bz2
takahe-53d94529175dface366a935eea2c2bcc1eeab15c.zip
Outgoing mentions mostly work (exc. cc followers)
Diffstat (limited to 'core')
-rw-r--r--core/html.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/html.py b/core/html.py
index 5045b16..3230284 100644
--- a/core/html.py
+++ b/core/html.py
@@ -30,3 +30,11 @@ def sanitize_post(post_html: str) -> str:
strip=True,
)
return mark_safe(cleaner.clean(post_html))
+
+
+def strip_html(post_html: str) -> str:
+ """
+ Strips all tags from the text, then linkifies it.
+ """
+ cleaner = bleach.Cleaner(tags=[], strip=True, filters=[LinkifyFilter])
+ return mark_safe(cleaner.clean(post_html))