mirror of
https://github.com/elk-zone/elk.git
synced 2024-11-04 16:09:59 +00:00
fix: decode numerically encoded html entities in text
This commit is contained in:
parent
408aff20ee
commit
4146915a33
2 changed files with 5 additions and 3 deletions
|
@ -72,7 +72,9 @@ export function parseMastodonHTML(html: string, customEmojis: Record<string, Emo
|
|||
[/\*(.*?)\*/g, '<em>$1</em>'],
|
||||
[/~~(.*?)~~/g, '<del>$1</del>'],
|
||||
[/`([^`]+?)`/g, '<code>$1</code>'],
|
||||
] 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) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Vitest Snapshot v1
|
||||
|
||||
exports[`html-parse > code frame > html 1`] = `
|
||||
"<p>Testing code block</p><p><pre><code class=\\"language-ts\\">import { useMouse, usePreferredDark } from '@vueuse/core'
|
||||
"<p>Testing code block</p><p><pre><code class=\\"language-ts\\">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
|
||||
|
|
Loading…
Reference in a new issue