Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown rendering for Matrix notifications #493

Open
MTRNord opened this issue Mar 17, 2023 · 1 comment
Open

Markdown rendering for Matrix notifications #493

MTRNord opened this issue Mar 17, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@MTRNord
Copy link

MTRNord commented Mar 17, 2023

Hi,

Initially I wanted to fix this myself, but it seems a little harder than initially expected.
Basically, notifications currently are rendered like this:

image

Which looks like raw markdown.
It would be nice to instead have them look like this:

image

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.

@darkowlzz
Copy link
Contributor

Hi, I think that'd be great.
Found https://github.com/gomarkdown/markdown to be useful for converting markdown to html easily.

@darkowlzz darkowlzz added enhancement New feature or request good first issue Good for newcomers labels Mar 20, 2023
@yiannistri yiannistri self-assigned this Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants