You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.7 KiB
52 lines
1.7 KiB
<script async src="https://cdn.jsdelivr.net/npm/mathjax@3.0/es5/tex-mml-chtml.js"></script> |
|
<!-- MathJax配置,可通过单美元符号书写行内公式等 --> |
|
|
|
<script> |
|
if (typeof MathJax === 'undefined') { |
|
window.MathJax = { |
|
loader: { |
|
source: { |
|
'[tex]/amsCd': '[tex]/amscd', |
|
'[tex]/AMScd': '[tex]/amscd' |
|
} |
|
}, |
|
tex: { |
|
inlineMath: {'[+]': [['$', '$']]}, |
|
tags: 'ams' |
|
}, |
|
options: { |
|
renderActions: { |
|
findScript: [10, doc => { |
|
document.querySelectorAll('script[type^="math/tex"]').forEach(node => { |
|
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); |
|
}); |
|
}, '', false], |
|
insertedScript: [200, () => { |
|
document.querySelectorAll('mjx-container').forEach(node => { |
|
let target = node.parentNode; |
|
if (target.nodeName.toLowerCase() === 'li') { |
|
target.parentNode.classList.add('has-jax'); |
|
} |
|
}); |
|
}, '', false] |
|
} |
|
} |
|
}; |
|
(function () { |
|
var script = document.createElement('script'); |
|
script.src = 'https://cdn.jsdelivr.net/npm/mathjax@3.0/es5/tex-mml-chtml.js'; |
|
script.defer = true; |
|
document.head.appendChild(script); |
|
})(); |
|
} else { |
|
MathJax.startup.document.state(0); |
|
MathJax.texReset(); |
|
MathJax.typeset(); |
|
} |
|
</script>
|
|
|