强烈谴责fps格式内嵌katex-html,div和stylesheet的行为

This commit is contained in:
undefined committed 2020-09-01 23:43:22 +08:00
1 parent 32a4f5eb4e
commit 0b0c34b0c6
6 files changed
+66 -9

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
import 'hydrooj';
import TurndownService from 'turndown';
import { JSDOM } from 'jsdom';
const turndownService = new TurndownService();
export function convertHTML(html: string) {
const DOM = new JSDOM(html);
const eles = DOM.window.document.querySelectorAll('span.katex-mathml');
eles.forEach((ele) => {
const MathML = ele.innerHTML;
ele.parentElement.replaceWith(MathML);
});
return turndownService.turndown(DOM.serialize());
}
global.Hydro.lib.convertHTML = convertHTML;