Try to strip HTML from the plain text body field

This commit is contained in:
Vesper committed 2026-03-27 21:30:06 +00:00
1 parent 05de0d6b34
commit 5f62b92ffe
1 file changed
+8 -1
+8 -1
View File
@@ -1331,7 +1331,14 @@ export const useCommands = (mx: MatrixClient, room: Room): CommandRecord => {
exe: async (payload) => {
await mx.sendMessage(room.roomId, {
msgtype: MsgType.Text,
body: payload,
body: payload
.replaceAll('<br>', '\n')
.replaceAll('<li>', '\n- ')
.replaceAll(
/<a(.*?)href="(?<link>(.*?))"(.*?)>(?<text>(.*?))<\/a>/g,
'[$<text>]($<link>)'
)
.replaceAll(/<[^>]*>/g, ''),
format: 'org.matrix.custom.html',
formatted_body: payload,
});