diff --git a/composables/content.ts b/composables/content.ts index b8b81ed3..97c66e9c 100644 --- a/composables/content.ts +++ b/composables/content.ts @@ -72,7 +72,9 @@ export function parseMastodonHTML(html: string, customEmojis: Record$1'], [/~~(.*?)~~/g, '$1'], [/`([^`]+?)`/g, '$1'], - ] as const + [/&#(\d+);/g, (_: string, dec: string) => String.fromCharCode(Number(dec))], + ] as any + for (const [re, replacement] of replacements) { for (const match of node.value.matchAll(re)) { if (node.loc) { diff --git a/tests/__snapshots__/html-parse.test.ts.snap b/tests/__snapshots__/html-parse.test.ts.snap index ffcd8d65..55208cf5 100644 --- a/tests/__snapshots__/html-parse.test.ts.snap +++ b/tests/__snapshots__/html-parse.test.ts.snap @@ -1,7 +1,7 @@ // Vitest Snapshot v1 exports[`html-parse > code frame > html 1`] = ` -"

Testing code block

import { useMouse, usePreferredDark } from '@vueuse/core'
+"

Testing code block

import { useMouse, usePreferredDark } from '@vueuse/core'
 // tracks mouse position
 const { x, y } = useMouse()
 // is the user prefers dark theme
@@ -12,7 +12,7 @@ exports[`html-parse > code frame > text 1`] = `
 "Testing code block
 
 \`\`\`ts
-import { useMouse, usePreferredDark } from '@vueuse/core'
+import { useMouse, usePreferredDark } from '@vueuse/core'
 // tracks mouse position
 const { x, y } = useMouse()
 // is the user prefers dark theme