Fix bot message newlines
This commit is contained in:
parent
f8d6302f10
commit
65d219c1b7
1 changed files with 4 additions and 2 deletions
|
|
@ -100,7 +100,8 @@ def get_requestable_groups(username: str) -> tuple[bool, str]:
|
||||||
group_lines.append(f"* `{name}`")
|
group_lines.append(f"* `{name}`")
|
||||||
|
|
||||||
group_list = "\n".join(group_lines)
|
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:
|
except KeycloakError as e:
|
||||||
return False, f"Keycloak API error: {str(e)}"
|
return False, f"Keycloak API error: {str(e)}"
|
||||||
|
|
@ -131,7 +132,8 @@ async def send_markdown_message(
|
||||||
msgtype: str = "m.text",
|
msgtype: str = "m.text",
|
||||||
relates_to: dict = None,
|
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 = {
|
content = {
|
||||||
"msgtype": msgtype,
|
"msgtype": msgtype,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue