Skip to content

Message parsing: Replace Markdown with HTML #281

@kiliankoe

Description

@kiliankoe

As recently learned in the chat, Matrix messages cannot be interpreted directly as markdown. Such formatting is purely coincidental, just as users directly using BBCode would be.

See this message content for example.

"content": {
  "msgtype": "m.text",
  "body": "*test*",
  "format": "org.matrix.custom.html",
  "formatted_body": "<em>test</em>"
}

The body contains markdown formatting, but this cannot be used directly. Instead we have to check the format, which will likely be non-existent for plaintext or org.matrix.custom.html like here. In that case we can interpret the formatted_body as HTML and render that.

It's totally up to clients to specify how users can markup their messages. For outgoing messages it would likely make sense for Nio to just assume markdown (and show a live formatting preview in the message composer), turn that into HTML and format the message content as above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions