从 运行 本身停止 mathjax

stop mathjax from running itself

我在 script 标签上使用 mathjax3.1.2async。但是,我发现它 运行 本身在文档加载时自动运行并搞砸了我的页面,因为我有纯文本等待 marked.js 首先呈现。

这是html内容:

equation_app.addEventListener('click', e=>{
  autofocus(e);
  let start = editor.selectionStart;
  let end = editor.selectionEnd;
  tagging('$', '$');
  editor.focus();
  if(editor.selectionStart === editor.selectionEnd)editor.selectionStart = editor.selectionEnd = start + 1;
  refresh();
});

标记渲染后,会被包装成<pre><code>标签。但是作为 MathJax 运行 之前,它被搞砸了:

equation_app.addEventListener('click', e=&gt;{
  autofocus(e);
  let start = editor.selectionStart;
  let end = editor.selectionEnd;
  tagging('<mjx-container class="MathJax CtxtMenu_Attached_0" jax="CHTML" role="presentation" tabindex="0" ctxtmenu_counter="0" style="font-size: 101.6%; position: relative;"><mjx-math class="MJX-TEX" aria-hidden="true"><mjx-msup><mjx-mi class="mjx-n"></mjx-mi><mjx-script style="vertical-align: 0.363em;"><mjx-mo class="mjx-n" size="s"><mjx-c class="mjx-c2032"></mjx-c></mjx-mo></mjx-script></mjx-msup><mjx-msup><mjx-mo class="mjx-n"><mjx-c class="mjx-c2C"></mjx-c></mjx-mo><mjx-script style="vertical-align: 0.363em;"><mjx-mo class="mjx-n" size="s"><mjx-c class="mjx-c2032"></mjx-c></mjx-mo></mjx-script></mjx-msup></mjx-math><mjx-assistive-mml role="presentation" unselectable="on" display="inline"><math xmlns="http://www.w3.org/1998/Math/MathML"><msup><mi></mi><mo>′</mo></msup><msup><mo>,</mo><mo>′</mo></msup></math></mjx-assistive-mml></mjx-container>');
  editor.focus();
  if(editor.selectionStart === editor.selectionEnd)editor.selectionStart = editor.selectionEnd = start + 1;
  refresh();
});

我做了很多研究,似乎在版本 2 skipStartupTypeset 中配置解决了问题,但是在版本 3 中删除了。

参考这个 post 4 年前:

我求方法:

只需在配置中设置以下内容,即可将 Mathjax 3 配置为在启动时不进行排版:

{
     startup: {
         typeset: false
     }
 }

文档:https://docs.mathjax.org/en/latest/options/startup/startup.html#the-configuration-block