Try to strip HTML from the plain text body field
This commit is contained in:
1 file changed
+8
-1
@@ -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,
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user