类似于楼上的,Demo 及详细过程:https://blog.hahahumble.com/archives/1679585660732
我的halo 服务好像不行(可版本有点老,版本<1.5),不过js插件替换为下面这个就可以
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.4/dist/katex.min.css" integrity="sha384-vKruj+a13U8yHIkAyGgK1J3ArTLzrFGBbBc0tDp4ad/EyewESeXE/Iv67Aj8gKZ0" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.4/dist/katex.min.js" integrity="sha384-PwRUT/YqbnEjkZO0zZxNqcxACrXe+j766U2amXcgMg5457rve2Y7I6ZJSm2A0mS4" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.4/dist/contrib/auto-render.min.js" integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
renderMathInElement(document.body, {
delimiters: [
{left: '$$', right: '$$', display: true},
{left: '$', right: '$', display: false},
{left: '\\(', right: '\\)', display: false},
{left: '\\[', right: '\\]', display: true}
],
throwOnError : false
});
});
</script>
另外markdown 文本好像需要采用这种“代码块+math“格式才能比较好渲染:
上图的公式:
$$ a+b $$
$$g(\lambda ,v)=inf \left\{ g_{1}(\lambda ,v),g_{2}(\lambda ,v), \ldots ,g_{\infty}(\lambda ,v)\right\}$$
$c = \pm\sqrt{a^2 + b^2}$
$$c = \pm\sqrt{a^2 + b^2}$$
$$\begin{align}
x &= a + b + c \\
y &= d + e \\
z &= f + g + h
\end{align}$$
效果: