Loading
柚木鉉の空間
0%
INITIALIZING
首页 文章 标签 归档 友链 推广 搜索
文档编号 // 5569EF 在线

在Jekyll中使用MathJax3显示数学公式

2020-03-13
更新: 2026-04-25
1417 字符
这篇文章写于 2020,已经超过 6 年了。内容可能已经过时。

在头部添加以下内容:

<script>
MathJax = {
tex: {
inlineMath: [['$', '$']],
displayMath: [['$$', '$$']],
processEnvironments: true,
processRefs: true
},
options: {
skipHtmlTags: ['noscript', 'style', 'textarea', 'pre', 'code'],
ignoreHtmlClass: 'tex2jax_ignore',
renderActions: {
find_script_mathtex: [
10,
function (doc) {
for (const node of document.querySelectorAll('script[type^="math/tex"]')) {
const display = !!node.type.match(/; *mode=display/);
const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display);
const text = document.createTextNode('');
node.parentNode.replaceChild(text, node);
math.start = { node: text, delim: '', n: 0 };
math.end = { node: text, delim: '', n: 0 };
doc.math.push(math);
}
},
''
]
}
},
svg: {
fontCache: 'global'
}
};
</script>
<script
id="MathJax-script"
async
src="https://cdn.staticfile.org/mathjax/3.0.1/es5/tex-svg.js"
></script>
WeChat Pay 微信
Alipay 支付宝
导航 // 相关文章
目录