diff --git a/files/helpers/regex.py b/files/helpers/regex.py index 1c1a1bce3..0a4af4e5c 100644 --- a/files/helpers/regex.py +++ b/files/helpers/regex.py @@ -196,3 +196,5 @@ reason_regex = re.compile('(/(post|comment)/[0-9]+)', flags=re.A) discord_username_regex = re.compile("(\s|^|>).{2,32}#[0-9]{4}(?=[^0-9]|$)", flags=re.A) underscore_in_link_regex = regex.compile("(?<=https:\/\/[^\s)]+)_", flags=regex.A) + +numbered_list_regex = re.compile('((\s|^)[0-9]+)\. ', flags=re.A) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 89ecebd52..2dd758fb7 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -298,6 +298,8 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_marseys sanitized = underscore_in_link_regex.sub(r'\_', sanitized) + sanitized = numbered_list_regex.sub(r'\1\. ', sanitized) + sanitized = markdown(sanitized) sanitized = strikethrough_regex.sub(r'\1\2', sanitized)