refactor: html parsing
This commit is contained in:
parent
d76e4bfaa5
commit
6944a74653
8 changed files with 152 additions and 124 deletions
|
@ -1,12 +1,5 @@
|
|||
// Vitest Snapshot v1
|
||||
|
||||
exports[`content-rich > JavaScript hrefs get removed 1`] = `
|
||||
"<p>
|
||||
<a href=\\"#\\" rel=\\"nofollow noopener noreferrer\\" target=\\"_blank\\">click me</a>
|
||||
</p>
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`content-rich > code frame 1`] = `
|
||||
"<p>Testing code block</p><p><pre lang=\\"ts\\">import { useMouse, usePreferredDark } from '@vueuse/core'
|
||||
// tracks mouse position
|
||||
|
@ -75,8 +68,3 @@ exports[`content-rich > link + mention 1`] = `
|
|||
</p>
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`content-rich > script tags get removed 1`] = `
|
||||
"<p></p>
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -67,7 +67,7 @@ describe('html-parse', () => {
|
|||
})
|
||||
|
||||
async function render(input: string, emojis?: Record<string, Emoji>) {
|
||||
const tree = parseMastodonHTML(input, emojis)
|
||||
const tree = parseMastodonHTML(input, { emojis })
|
||||
const html = await renderTree(tree)
|
||||
let formatted = ''
|
||||
const serializedText = treeToText(tree).trim()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue