diff options
| author | auric <auric7@protonmail.com> | 2026-02-22 21:31:55 -0600 |
|---|---|---|
| committer | auric <auric7@protonmail.com> | 2026-02-22 21:31:55 -0600 |
| commit | 95855f83d7890b70489326ce9efeddca164fc447 (patch) | |
| tree | eaba1a9ad46d83b57adff41031ef239bf1d2444f | |
| parent | bda05f29c1be365b35b8fd0435a56ad49db3dc8c (diff) | |
umbrella-bot: add nl2br extension to preserve newlines in Matrix messages
markdown.markdown() collapses single newlines into soft wraps, causing
multi-line responses (e.g. !units list) to render as one long line.
The nl2br extension converts \n to <br> in the HTML output.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| -rwxr-xr-x | clients/umbrella-bot/umbrella-bot.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clients/umbrella-bot/umbrella-bot.py b/clients/umbrella-bot/umbrella-bot.py index d6c6edb..ef90fc8 100755 --- a/clients/umbrella-bot/umbrella-bot.py +++ b/clients/umbrella-bot/umbrella-bot.py @@ -399,7 +399,7 @@ async def run_bot(config: dict): "msgtype": "m.text", "body": reply, "format": "org.matrix.custom.html", - "formatted_body": md_lib.markdown(reply, extensions=["fenced_code"]), + "formatted_body": md_lib.markdown(reply, extensions=["fenced_code", "nl2br"]), }, ignore_unverified_devices=True, ) |
