New option mathjax.tags

This commit is contained in:
Mimi 2020-12-03 11:54:19 +08:00
parent 851bf27836
commit ff3b9571c0
5 changed files with 6 additions and 15 deletions

View File

@ -504,6 +504,8 @@ math:
mathjax:
enable: false
# Available values: none | ams | all
tags: none
katex:
enable: false

View File

@ -8,7 +8,7 @@
<aside class="sidebar">
{%- set display_toc = page.toc.enable and display_toc %}
{%- if display_toc %}
{%- set toc = toc(page.content, { class: "nav", list_number: page.toc.number, max_depth: page.toc.max_depth }) %}
{%- set toc = toc(page.content, {class: 'nav', list_number: page.toc.number, max_depth: page.toc.max_depth}) %}
{%- set display_toc = toc.length > 1 and display_toc %}
{%- endif %}

View File

@ -24,7 +24,7 @@
{%- endfor %}
{%- endif %}
{{ next_url(itemURL, menuIcon + menuText + menuBadge, {rel: 'section'}) }}
{{- next_url(itemURL, menuIcon + menuText + menuBadge, {rel: 'section'}) -}}
</li>

View File

@ -12,7 +12,7 @@ NexT.utils.loadComments('#gitalk-container', () => {
admin : ['{{ theme.gitalk.admin_user }}'],
id : '{{ gitalk_md5(page.path) }}',
{%- if theme.gitalk.language == '' %}
language: window.navigator.language || window.navigator.userLanguage,
language: window.navigator.language,
{% else %}
language: '{{ theme.gitalk.language }}',
{%- endif %}

View File

@ -3,21 +3,10 @@
window.MathJax = {
tex: {
inlineMath: {'[+]': [['$', '$']]},
tags: 'ams'
tags: '{{ theme.math.mathjax.tags }}'
},
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 => {
const target = node.parentNode;