Fix bot message newlines

This commit is contained in:
Astra Logical 2026-07-22 18:25:46 -04:00
parent f8d6302f10
commit 65d219c1b7

View file

@ -100,7 +100,8 @@ def get_requestable_groups(username: str) -> tuple[bool, str]:
group_lines.append(f"* `{name}`")
group_list = "\n".join(group_lines)
return True, f"**Available Groups:**\n{group_list}"
# Added extra \n before {group_list} to satisfy Markdown list block rules
return True, f"**Available Groups:**\n\n{group_list}"
except KeycloakError as e:
return False, f"Keycloak API error: {str(e)}"
@ -131,7 +132,8 @@ async def send_markdown_message(
msgtype: str = "m.text",
relates_to: dict = None,
):
html_body = markdown.markdown(md_text, extensions=["extra", "sane_lists"])
# Added "nl2br" extension to preserve single line breaks in chat messages
html_body = markdown.markdown(md_text, extensions=["extra", "sane_lists", "nl2br"])
content = {
"msgtype": msgtype,