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.