1
0
Fork 0

update discord-markdown to escape less stuff

This commit is contained in:
Cadence Ember 2023-08-18 01:22:33 +12:00
parent 6de13338a8
commit 2d14e84312
4 changed files with 44 additions and 3 deletions

View file

@ -39,6 +39,16 @@ test("message2event: simple plaintext", async t => {
}])
})
test("message2event: simple plaintext with quotes", async t => {
const events = await messageToEvent(data.message.simple_plaintext_with_quotes, data.guild.general, {})
t.deepEqual(events, [{
$type: "m.room.message",
"m.mentions": {},
msgtype: "m.text",
body: `then he said, "you and her aren't allowed in here!"`
}])
})
test("message2event: simple user mention", async t => {
const events = await messageToEvent(data.message.simple_user_mention, data.guild.general, {})
t.deepEqual(events, [{

4
package-lock.json generated
View file

@ -11,7 +11,7 @@
"dependencies": {
"better-sqlite3": "^8.3.0",
"cloudstorm": "^0.8.0",
"discord-markdown": "git+https://git.sr.ht/~cadence/nodejs-discord-markdown#9799e4f79912d07f89a030e479e82fcc1e75bc81",
"discord-markdown": "git+https://git.sr.ht/~cadence/nodejs-discord-markdown#440130ef343c8183a81c7c09809731484aa3a182",
"heatsync": "^2.4.1",
"js-yaml": "^4.1.0",
"matrix-appservice": "^2.0.0",
@ -1051,7 +1051,7 @@
},
"node_modules/discord-markdown": {
"version": "2.4.1",
"resolved": "git+https://git.sr.ht/~cadence/nodejs-discord-markdown#9799e4f79912d07f89a030e479e82fcc1e75bc81",
"resolved": "git+https://git.sr.ht/~cadence/nodejs-discord-markdown#440130ef343c8183a81c7c09809731484aa3a182",
"license": "MIT",
"dependencies": {
"simple-markdown": "^0.7.2"

View file

@ -17,7 +17,7 @@
"dependencies": {
"better-sqlite3": "^8.3.0",
"cloudstorm": "^0.8.0",
"discord-markdown": "git+https://git.sr.ht/~cadence/nodejs-discord-markdown#9799e4f79912d07f89a030e479e82fcc1e75bc81",
"discord-markdown": "git+https://git.sr.ht/~cadence/nodejs-discord-markdown#440130ef343c8183a81c7c09809731484aa3a182",
"heatsync": "^2.4.1",
"js-yaml": "^4.1.0",
"matrix-appservice": "^2.0.0",

View file

@ -170,6 +170,37 @@ module.exports = {
flags: 0,
components: []
},
simple_plaintext_with_quotes: {
id: "1126733830494093454",
type: 0,
content: `then he said, "you and her aren't allowed in here!"`,
channel_id: "112760669178241024",
author: {
id: "111604486476181504",
username: "kyuugryphon",
avatar: "e4ce31267ca524d19be80e684d4cafa1",
discriminator: "0",
public_flags: 0,
flags: 0,
banner: null,
accent_color: null,
global_name: "KyuuGryphon",
avatar_decoration: null,
display_name: "KyuuGryphon",
banner_color: null
},
attachments: [],
embeds: [],
mentions: [],
mention_roles: [],
pinned: false,
mention_everyone: false,
tts: false,
timestamp: "2023-07-07T04:37:58.892000+00:00",
edited_timestamp: null,
flags: 0,
components: []
},
simple_user_mention: {
id: "1126739682080858234",
type: 0,