Cirry's Blog

Markdown添加mathjax支持

2023-02-08
astro
astro
最后更新:2024-04-18
1分钟
110字

添加Mathjax

1
<script type="text/x-mathjax-config">
2
MathJax.Hub.Config({
3
tex2jax: {
4
inlineMath: [
5
["\\(", "\\)"],
6
],
7
},
8
});
9
</script>
10
{
11
mathjax &&
12
<script async type="text/javascript" src="https://cdn.bootcdn.net/ajax/libs/mathjax/3.2.2/es5/tex-chtml.min.js"></script>
13
}

测试展示

1
$$ 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 $$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$

优点:不需要添加其他插件即可在页面上直接显示公式。

缺点:添加了mathjax支持之后,网页加载会变慢。

参考文档

本文标题:Markdown添加mathjax支持
文章作者:Cirry
发布时间:2023-02-08
版权声明:本作品采用「署名-非商业性使用-相同方式共享 4.0 国际」许可协议进行许可。
感谢大佬送来的咖啡☕
alipayQRCode
wechatQRCode