Skip to content

Instantly share code, notes, and snippets.

@kythyria
Last active October 3, 2016 21:16
Show Gist options
  • Save kythyria/b70f642fd2858e96b5dab96234bedf09 to your computer and use it in GitHub Desktop.
Save kythyria/b70f642fd2858e96b5dab96234bedf09 to your computer and use it in GitHub Desktop.

Two input strings:

!test1 one_two three_four five
!test2 one\_two three\_four five

With the RTE off, these get sent as

"content": {
  "body": "!test1 one_two three_four five",
  "msgtype": "m.text"
}

"content": {
  "body": "!test2 one\\_two three\\_four five",
  "msgtype": "m.text",
  "formatted_body": "!test2 one_two three_four five",
  "format": "org.matrix.custom.html"
}

With it on, as

"content": {
  "body": "!test1 one_two three_four five",
  "msgtype": "m.text",
  "formatted_body": "!test3 one_two three_four five<br />",
  "format": "org.matrix.custom.html"
},

"content": {
  "body": "!test2 one\\_two three\\_four five",
  "msgtype": "m.text",
  "formatted_body": "!test4 one_two three_four five<br />",
  "format": "org.matrix.custom.html"
},

FWIW, github renders them this way:

!test1 one_two three_four five

!test2 one_two three_four five

And I'd expect Riot to consistently pick the first or third renderings.

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