mirror of
https://github.com/next-theme/hexo-theme-next.git
synced 2026-01-19 18:42:34 +00:00
32 lines
889 B
Plaintext
32 lines
889 B
Plaintext
<script>
|
|
if (typeof MathJax === 'undefined') {
|
|
window.MathJax = {
|
|
tex: {
|
|
inlineMath: {'[+]': [['$', '$']]},
|
|
tags: '{{ theme.math.mathjax.tags }}'
|
|
},
|
|
options: {
|
|
renderActions: {
|
|
insertedScript: [200, () => {
|
|
document.querySelectorAll('mjx-container').forEach(node => {
|
|
const target = node.parentNode;
|
|
if (target.nodeName.toLowerCase() === 'li') {
|
|
target.parentNode.classList.add('has-jax');
|
|
}
|
|
});
|
|
}, '', false]
|
|
}
|
|
}
|
|
};
|
|
const script = document.createElement('script');
|
|
script.src = '{{ theme.vendors.mathjax }}';
|
|
script.defer = true;
|
|
document.head.appendChild(script);
|
|
} else {
|
|
MathJax.startup.document.state(0);
|
|
MathJax.typesetClear();
|
|
MathJax.texReset();
|
|
MathJax.typeset();
|
|
}
|
|
</script>
|