Don't convert markdown to plaintext

This commit is contained in:
Cohee 2024-05-20 00:48:23 +03:00
parent 8c11d7e8e8
commit edf981a5a1

View File

@ -1341,11 +1341,7 @@ export async function extractTextFromHTML(blob, textSelector = 'body') {
*/ */
export async function extractTextFromMarkdown(blob) { export async function extractTextFromMarkdown(blob) {
const markdown = await blob.text(); const markdown = await blob.text();
const converter = new showdown.Converter(); const text = postProcessText(markdown, false);
const html = converter.makeHtml(markdown);
const domParser = new DOMParser();
const document = domParser.parseFromString(DOMPurify.sanitize(html), 'text/html');
const text = postProcessText(document.body.textContent, false);
return text; return text;
} }