|
|
@@ -7,6 +7,9 @@
|
|
|
* 将 HTML 中的 LaTeX 公式渲染为 KaTeX HTML
|
|
|
*/
|
|
|
|
|
|
+import { createRequire } from 'module';
|
|
|
+const require = createRequire(import.meta.url);
|
|
|
+
|
|
|
// 尝试多个路径加载 KaTeX
|
|
|
let katex;
|
|
|
const possiblePaths = [
|
|
|
@@ -19,11 +22,9 @@ let loadError = null;
|
|
|
for (const modulePath of possiblePaths) {
|
|
|
try {
|
|
|
katex = require(modulePath);
|
|
|
- // console.error('KaTeX loaded from:', modulePath);
|
|
|
break;
|
|
|
} catch (e) {
|
|
|
loadError = e;
|
|
|
- // 继续尝试下一个路径
|
|
|
}
|
|
|
}
|
|
|
|