hexo-theme-butterfly/layout/includes/third-party/math/mathjax.pug
Jerry 829a3dbf32 breaking changes: 移除最新評論的評論服務商選擇,默認為第一個評論服務商
feat: 增加 waline avatarCDN 配置(最新評論也會更新)
feat: archives 的 標題 在 menu 配置中獲取
fix: 修復文章頁 mathjax 因字體小導致顯示重疊的 bug close #587
fix: 修復 mathjax 在列表下,導致 列表沒有樣式的 bug  close #586
improvement: 減少卡頓,apple 裝置首頁背景 background-attachment 設為 scroll
2021-06-09 14:33:55 +08:00

38 lines
1.1 KiB
Plaintext

//- Mathjax 3
script.
if (!window.MathJax) {
window.MathJax = {
tex: {
inlineMath: [ ['$','$'], ["\\(","\\)"]],
tags: 'ams'
},
chtml: {
scale: 1.2
},
options: {
renderActions: {
findScript: [10, 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)
}
}, '']
}
}
}
const script = document.createElement('script')
script.src = '!{theme.CDN.mathjax}'
script.id = 'MathJax-script'
script.async = true
document.head.appendChild(script)
} else {
MathJax.startup.document.state(0)
MathJax.texReset()
MathJax.typeset()
}