We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e3c8e75 commit 26e48f2Copy full SHA for 26e48f2
1 file changed
src/lib/utils/index.ts
@@ -22,6 +22,7 @@ import { marked } from 'marked';
22
import markedExtension from '$lib/utils/marked/extension';
23
import markedKatexExtension from '$lib/utils/marked/katex-extension';
24
import hljs from 'highlight.js';
25
+import { decode } from 'html-entities';
26
27
//////////////////////////
28
// Helper functions
@@ -168,9 +169,8 @@ function processChineseDelimiters(
168
169
});
170
}
171
-export function unescapeHtml(html: string) {
172
- const doc = new DOMParser().parseFromString(html, 'text/html');
173
- return doc.documentElement.textContent;
+export function unescapeHtml(html: string): string {
+ return decode(html);
174
175
176
export const capitalizeFirstLetter = (string) => {
0 commit comments