googlechat
googlechat copied to clipboard
Google chat multi line code-blocks do not render properly on element desktop
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.
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.
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.