MathJax输出中的垃圾html

时间:2016-05-11 13:54:29

标签: html mathjax

每当我运行MathJax时,我会在输出html中看到如下内容:

<div style="visibility: hidden; overflow: hidden; position: absolute; top: 0px; height: 1px; width: auto; padding: 0px; border: 0px; margin: 0px; text-align: left; text-indent: 0px; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal;"><div id="MathJax_Hidden"><br><br><br><br></div></div>

除非我弄错了,否则什么都不做。有没有办法防止它发生?

在我的用例中,我只使用最终的html。因此我不在乎在被jaxed时看起来像什么。

这是另一个:

<div style="position: absolute; width: 0px; height: 0px; overflow: hidden; padding: 0px; border: 0px; margin: 0px;"><div id="MathJax_Font_Test" style="position: absolute; visibility: hidden; top: 0px; left: 0px; width: auto; padding: 0px; border: 0px; margin: 0px; white-space: nowrap; text-align: left; text-indent: 0px; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; font-size: 40px; font-weight: normal; font-style: normal; font-family: MathJax_Math-italic, sans-serif;"></div></div>

编辑:这是我的配置:

MathJax.Hub.Config({
  jax: ["input/TeX", "output/NativeMML"],
  extensions: ["tex2jax.js"],
  messageStyle: "none",
  tex2jax: {preview: 'none'},
  TeX: {
    extensions: ["AMSmath.js", "AMSsymbols.js", "noErrors.js", "noUndefined.js"]
  }
});

1 个答案:

答案 0 :(得分:1)

您指定的两个div来自HTML-CSS输出。由于您的配置中有NativeMML输出,我想知道您是否正在加载包含HTML-CSS输出的组合配置文件?你没有显示实际加载MathJax.js的脚本,所以我不能说,但它看起来好像已加载了HTML-CSS输出jax。根据您使用的配置,您在加载?config=的网址中不需要MathJax.js

需要注意的一点是:NativeMML输出是特定于浏览器的,因为MathJax将尝试解决各种浏览器的MathML支持中的缺陷。例如,Firefox不支持<mlabeledtr>,因此当有标记的方程时,MathJax将使用替代(不太有意义)的标记。因此,您获得的结果可能取决于您使用的浏览器。

您可能还需要考虑使用mathjax-node,它是MathJax的命令行界面,可用于处理单个方程式或完整页面。这样你就不必使用浏览器了。

相关问题