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

Google chat multi line code-blocks do not render properly on element desktop #78

Open
Roukoswarf opened this issue Sep 14, 2022 · 2 comments

Comments

@Roukoswarf
Copy link

Roukoswarf commented Sep 14, 2022

When sent a codeblock such as:

testing
a
codeblock

From a google chat user, the message will be rendered as a single line lacking \n in element desktop.
This is technically element-desktop/element-web's fault, as it does appear properly in element mobile, but is not a problem on matrix to matrix as the message json is different.

Examples:

From bridge:

{
  "type": "m.room.message",
  "content": {
    "msgtype": "m.text",
    "body": "```This message is line 1.\nThis message is line 2.\nThis message is line 3.\nThis message is line 4.```",
    "format": "org.matrix.custom.html",
    "formatted_body": "<pre><code>This message is line 1.<br/>This message is line 2.<br/>This message is line 3.<br/>This message is line 4.</code></pre>",
    "com.beeper.linkpreviews": []
  }
}

From element:

{
  "type": "m.room.message",
  "content": {
    "org.matrix.msc1767.message": [
      {
        "body": "```\nthings\nstuff\nwords\n```",
        "mimetype": "text/plain"
      },
      {
        "body": "<pre><code>things\nstuff\nwords\n</code></pre>\n",
        "mimetype": "text/html"
      }
    ],
    "body": "```\nthings\nstuff\nwords\n```",
    "msgtype": "m.text",
    "format": "org.matrix.custom.html",
    "formatted_body": "<pre><code>things\nstuff\nwords\n</code></pre>\n"
  }
}

I am not sure if this is something I should instead be reporting to element, or if the bridge should add text/html to make element-desktop/web happy.

@tulir
Copy link
Member

tulir commented Sep 14, 2022

Where do you see it as a single line? Only the line numbering is broken for me, the breaks are there 🤔

It's not related to org.matrix.msc1767.message, but it's definitely a client bug (specifically, it doesn't handle <br/> properly). I might still work around it in the bridge since I don't think element web is the only client that has bugs in that area.

@Roukoswarf
Copy link
Author

I played with some settings, it seems to be dependent on syntax highlighting being enabled clientside for codeblocks.

I can reproduce the broken line numbering by disabling syntax highlighting, resulting in the entire 3 line block rendering as line "1".
Once highlighting is switched on, messages from the bridge appear in one line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants