element-hq / element-web

A glossy Matrix collaboration client for the web.
https://element.io
GNU Affero General Public License v3.0
11.04k stars 1.96k forks source link

Pills for users with backticks get converted to code when complimented with another backtick #7134

Open turt2live opened 6 years ago

turt2live commented 6 years ago

Where curly brackets represent a pill, here's an example:

{Bob}: Hey

image

  "content": {
    "body": "TravisR`: hi there`",
    "msgtype": "m.text",
    "formatted_body": "[TravisR<code>](https://matrix.to/#/@travis:t2l.io): hi there</code>",
    "format": "org.matrix.custom.html"
  },
lampholder commented 6 years ago

We (obviously) shouldn't be parsing the display name within the pill as markdown (though I fear that might be quite tricky to implement).

At the moment I can only think of display-names-containing-markdown that might make things look a bit cosmetically weird. If there's anything worse than that this might be worth bumping to a P1.

joepie91 commented 5 years ago

Another case:

Selection_0015 Selection_0016

The solution here would probably be to escape special characters in the URL text (using backslashes) and the hyperlink (using percent-encoding).

The current rendering itself does seem to be correct according to CommonMark: https://babelmark.github.io/?text=%5Bfoo%60%5D(http%3A%2F%2Fexample.com%2Fbar%60%2Fbaz) - so this would be an issue in the code that converts a highlight to a Markdown link, not in the client rendering.

Message source:

{
  "unsigned": {
    "transaction_id": "m1558341085491.761",
    "age": 53
  },
  "event_id": "$15583410851132WwVxa:alternanet.fr",
  "sender": "@joepie91:alternanet.fr",
  "content": {
    "msgtype": "m.text",
    "body": "joepie91`: test",
    "format": "org.matrix.custom.html",
    "formatted_body": "[joepie91<code>](https://matrix.to/#/@freenode_joepie91</code>:matrix.org): test"
  },
  "type": "m.room.message",
  "origin_server_ts": 1558341085561,
  "room_id": "!FpSNdNQOADEwDHqmrC:matrix.org"
}