mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
强烈谴责fps格式内嵌katex-html,div和stylesheet的行为
This commit is contained in:
1 parent
32a4f5eb4e
commit
0b0c34b0c6
6 files changed
+66
-9
No files matched your search
@@ -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;
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "@hydrooj/html2md",
|
||||
"version": "1.0.0",
|
||||
"description": "turn html into markdown",
|
||||
"main": "package.json",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
"author": "undefined <masnn0@outlook.com>",
|
||||
"license": "AGPL-3.0-only",
|
||||
"dependencies": {
|
||||
"hydrooj": "^2.12.22",
|
||||
"jsdom": "^16.4.0",
|
||||
"turndown": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jsdom": "^16.2.3",
|
||||
"@types/turndown": "^5.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"lint": "eslint . --ext ts --fix"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es2019",
|
||||
"module": "commonjs",
|
||||
"esModuleInterop": true,
|
||||
"moduleResolution": "node",
|
||||
"declaration": true,
|
||||
"sourceMap": true,
|
||||
"composite": true,
|
||||
"strictBindCallApply": true,
|
||||
"experimentalDecorators": true,
|
||||
"outDir": ".",
|
||||
"rootDir": "."
|
||||
},
|
||||
"include": [
|
||||
"*.ts"
|
||||
],
|
||||
"exclude": []
|
||||
}
|
||||
Reference in new issue
Block a user