feat: allow fps zipfile

This commit is contained in:
undefined committed 2020-09-04 12:51:15 +08:00
1 parent efa3faea5d
commit c0489546b8
5 files changed
+17 -51

No files matched your search

+1 -10
View File
@@ -1,6 +1,5 @@
import 'hydrooj';
import TurndownService from 'turndown';
import { JSDOM } from 'jsdom';
const turndownService = new TurndownService({
headingStyle: 'atx',
@@ -9,15 +8,7 @@ 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
.replace(/\\{/gmi, '{')
.replace(/\\}/gmi, '}');
ele.parentElement.replaceWith(`$${MathML}$`);
});
return turndownService.turndown(DOM.serialize());
return turndownService.turndown(html);
}
global.Hydro.lib.convertHTML = convertHTML;