改用katex进行渲染,支持离线渲染

This commit is contained in:
xunbu
2025-05-26 22:08:14 +08:00
parent 40a4cb0b62
commit 3390a1f967
10 changed files with 9169 additions and 522 deletions

View File

@@ -4,36 +4,37 @@
<meta charset="UTF-8">
<title>{{title}}</title>
{{pico}}
{{katexCss}}
{{katexJs}}
{{autoRender}}
<style>
html {
padding: 2vh 10vw;
font-size: 15px;
}
mjx-merror { display: none !important; }
</style>
<script>
MathJax = {
loader: {load: ['[tex]/ams']},
tex: {
inlineMath: [['$', '$'], ['\\(', '\\)']],
displayMath: [['$$', '$$'], ['\\[', '\\]']],
processEscapes: true,
packages: {'[+]': ['ams']}, // 启用AMS宏包
autoload: {color: [], colorv2: ['color']} // 颜色支持
},
options: {
renderActions: {
addMenu: [0, '', ''],
}
},
};
</script>
{{MathJax}}
</head>
<body>
{{markdown}}
</body>
<script>
document.addEventListener("DOMContentLoaded", function () {
renderMathInElement(document.body, {
delimiters: [
{left: '$$', right: '$$', display: true}, // 块级公式
{left: '\\[', right: '\\]', display: true}, // 块级公式
{left: '$', right: '$', display: false}, // 行内公式
{left: '\\(', right: '\\)', display: false} // 行内公式 (常用)
],
// • rendering keys, e.g.:
throwOnError: false
});
});
</script>
{{mermaid}}
<script>
mermaid.initialize({
securityLevel: 'loose',