Put < > around ALL the matrix.to links

This commit is contained in:
Cadence Ember 2024-03-23 21:26:42 +13:00
parent 566b2a9d9e
commit 7a00b95883
2 changed files with 35 additions and 1 deletions

View file

@ -724,7 +724,7 @@ async function eventToMessage(event, guild, di) {
content = turndownService.turndown(root)
// Put < > around any surviving matrix.to links to hide the URL previews
content = content.replace(/\bhttps?:\/\/matrix\.to\/[^ )]*/, "<$&>")
content = content.replace(/\bhttps?:\/\/matrix\.to\/[^ )]*/g, "<$&>")
// It's designed for commonmark, we need to replace the space-space-newline with just newline
content = content.replace(/ \n/g, "\n")