mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
feat: allow fps zipfile
This commit is contained in:
1 parent
efa3faea5d
commit
c0489546b8
5 files changed
+17
-51
No files matched your search
+1
-10
@@ -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;
|
||||
Reference in new issue
Block a user