From daedb5f0478ce7baa694d62430199fa1385cc4e1 Mon Sep 17 00:00:00 2001 From: Aevann Date: Fri, 30 Jun 2023 22:47:30 +0300 Subject: [PATCH] nasty hack to stop underscores being interpreted as italic which breaks mentioning users with two underscores and links sometimes --- files/helpers/sanitize.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index edb37bf22..10a67cd71 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -367,7 +367,9 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=False, count_emojis sanitized = strikethrough_regex.sub(r'\1\2', sanitized) + sanitized = sanitized.replace('_', '▔') sanitized = markdown(sanitized) + sanitized = sanitized.replace('▔', '_') # replacing zero width characters, overlines, fake colons sanitized = sanitized.replace('\u200e','').replace('\u200b','').replace("\ufeff", "").replace("\u033f","").replace("\u0589", ":")