diff --git a/matrix_keycloak_bot.py b/matrix_keycloak_bot.py index 00886fc..6fa8558 100644 --- a/matrix_keycloak_bot.py +++ b/matrix_keycloak_bot.py @@ -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,