添加 Mathjax#
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [
["\\(", "\\)"],
],
},
});
</script>
{
mathjax &&
<script async type="text/javascript" src="https://cdn.bootcdn.net/ajax/libs/mathjax/3.2.2/es5/tex-chtml.min.js"></script>
}
测试展示#
$$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$
When $a \ne 0$, there are two solutions to $(ax^2 + bx + c = 0)$ and they are
优点:不需要添加其他插件即可在页面上直接显示公式。
缺点:添加了 mathjax 支持之后,网页加载会变慢。