添加 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} $$
當 $a \ne 0$ 時,方程式 $(ax^2 + bx + c = 0)$ 有兩個解,分別為
優點:不需要添加其他插件即可在頁面上直接顯示公式。
缺點:添加了 mathjax 支持之後,網頁加載會變慢。