From 040d4c92854662da5b0cb6a4523eb6d76e25282b Mon Sep 17 00:00:00 2001 From: Christian Gick Date: Mon, 23 Feb 2026 11:51:48 +0200 Subject: [PATCH] fix(markup): add heading support to _md_to_html (h1/h2/h3) Co-Authored-By: Claude Opus 4.6 --- bot.py | 4 ++++ 1 file changed, 4 insertions(+) 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