diff --git a/bot.py b/bot.py index 85438f2..e7747cc 100644 --- a/bot.py +++ b/bot.py @@ -1497,6 +1497,10 @@ class Bot: safe = re.sub(r"\[([^\]]+)\]\(([^)]+)\)", _link_repl, safe) # Bare URLs (not already in an tag) safe = re.sub(r'(?)(https?://[^\s<]+)', r'\1', safe) + # Headings (### before ## before # to match longest first) + safe = re.sub(r"^### (.+)$", r"

\1

", safe, flags=re.MULTILINE) + safe = re.sub(r"^## (.+)$", r"

\1

", safe, flags=re.MULTILINE) + safe = re.sub(r"^# (.+)$", r"

\1

", safe, flags=re.MULTILINE) # Line breaks safe = safe.replace("\n", "
") return safe