Markdown rendering for Matrix notifications
MTRNord opened this issue · comments
Hi,
Initially I wanted to fix this myself, but it seems a little harder than initially expected.
Basically, notifications currently are rendered like this:
Which looks like raw markdown.
It would be nice to instead have them look like this:
This seems a lot more readable to me.
I hope this makes sense and could be worked on :)
For context, the JSON event of the formatted version looks like this:
{
"type": "m.room.message",
"content": {
"msgtype": "m.text",
"body": "💫 **kustomization/infra-notifications.flux-system**\n\nReconciliation finished in **117.422276ms**, next run in **1h0m0s**\n\n- **commit\\_status:** `update`\n- **revision:** `main@sha1:f021a600b031253be81b2ab58ed0d37271b74ead`\n- **summary:** `production cluster`",
"format": "org.matrix.custom.html",
"formatted_body": "<p>💫 <strong>kustomization/infra-notifications.flux-system</strong></p>\n<p>Reconciliation finished in <strong>117.422276ms</strong>, next run in <strong>1h0m0s</strong></p>\n<ul>\n<li><strong>commit_status:</strong> <code>update</code></li>\n<li><strong>revision:</strong> <code>main@sha1:f021a600b031253be81b2ab58ed0d37271b74ead</code></li>\n<li><strong>summary:</strong> <code>production cluster</code></li>\n</ul>\n"
}
The most important changes are that there is an additional formatted_body
which needs to be HTML and there is "format": "org.matrix.custom.html"
indicating that this is a formatted message.
Hi, I think that'd be great.
Found https://github.com/gomarkdown/markdown to be useful for converting markdown to html easily.