2023-06-10
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
| function loadScript(src, type = "text/javascript",async = true) {
var scriptEle = document.createElement('script');
scriptEle.src = src;
scriptEle.type = type;
scriptEle.async = async;
scriptEle.defer = true;
return new Promise((resolve, reject) => {
scriptEle.onload = e => resolve(e);
scriptEle.onerror = e => reject(e);
document.head.appendChild(scriptEle);
});
}
// example
loadScript('https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js')
.then(() => {
mermaid.initialize({
startOnLoad: true,
theme: 'neutral',
pie: {
useMaxWidth: false
}
});
})
.catch(e => {
console.error("failed to load mermaid.min.js:", e)
})
|
MathJax 自带自动编号公式的功能,可通过这样配置开启:
1
2
3
4
5
| window.MathJax = {
tex: {
tags: 'ams'
}
}
|
这样配置之后,在等式(equation)环境中的内容将会被自动编号。
$$\begin{equation}
E = mc^2
\end{equation}
$$
$$\begin{equation}
E = mc^2
\end{equation}
$$
$$\begin{equation}
E = mc^2
\end{equation}
$$
$$\begin{equation}
E = mc^2
\end{equation}
$$$$\begin{equation}
E = mc^2
\end{equation}
$$$$\begin{equation}
E = mc^2
\end{equation}
$$