From 18607e39b5a10750f9b8760e82b166295ebb5eee Mon Sep 17 00:00:00 2001 From: Christian Gick Date: Sat, 28 Feb 2026 13:54:24 +0200 Subject: [PATCH] fix(MAT-64): Convert --- to proper
in markdown-to-HTML The _md_to_html method was missing horizontal rule conversion, so --- rendered as literal dashes. Now converts to
and strips adjacent
tags for clean spacing. Co-Authored-By: Claude Opus 4.6 --- bot.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index a7fb8f0..d768033 100644 --- a/bot.py +++ b/bot.py @@ -97,7 +97,7 @@ IMPORTANT RULES — FOLLOW THESE STRICTLY: - You can generate images when asked — use the generate_image tool for any image creation, drawing, or illustration requests. - You can search the web using the web_search tool. Use it when users ask about current events, facts, or anything that needs up-to-date information. - When you use web_search, embed source links INLINE in the text where the information appears, e.g. "Laut [Cyprus Mail](url) hat..." or "([Quelle](url))". Do NOT collect links in a separate section at the bottom. Every claim from a search result must have its source linked right there in the sentence. -- Keep formatting compact. STRICT rules: NEVER use headings (no #, ##, ###). Use **bold text** for section titles instead. NEVER use horizontal rules (---). NEVER add blank lines between list items. Put section title and its content on consecutive lines with no blank line in between. Maximum one blank line between sections. +- Keep formatting compact. STRICT rules: NEVER use headings (no #, ##, ###). Use **bold text** for section titles instead. Use --- sparingly to separate major sections. NEVER add blank lines between list items or between a section title and its content. Maximum one blank line between sections. - You can search Confluence and Jira using tools. When users ask about documentation, wiki pages, tickets, or tasks, use the appropriate tool. Use confluence_recent_pages FIRST to show recently edited pages before searching. - When creating Jira issues, always confirm the project key and summary with the user before creating. - If a user's Atlassian account is not connected, tell them to connect it at matrixhost.eu/settings and provide the link. @@ -2261,11 +2261,14 @@ class Bot: 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) + # Horizontal rules (--- on its own line) + safe = re.sub(r"^-{3,}$", r"
", safe, flags=re.MULTILINE) # Line breaks safe = safe.replace("\n", "
") # Remove redundant
after block elements safe = re.sub(r"()(
)+", r"\1", safe) safe = re.sub(r"()(
)+", r"\1", safe) + safe = re.sub(r"(
)*(
)(
)*", r"\2", safe) return safe async def _generate_and_send_image(self, room_id: str, prompt: str):