【发布时间】:2017-07-28 11:18:08
【问题描述】:
这个 sn-p 发布在 Hugo 的 MathJax 支持页面上。我把它插入到一个部分中(比如,head.html)。
<script type="text/x-mathjax-config">
MathJax.Hub.Queue(function() {
// Fix <code> tags after MathJax finishes running. This is a
// hack to overcome a shortcoming of Markdown. Discussion at
// https://github.com/mojombo/jekyll/issues/199
var all = MathJax.Hub.getAllJax(), i;
for(i = 0; i < all.length; i += 1) {
all[i].SourceElement().parentNode.className += ' has-jax';
}
});
</script>
页面加载时,浏览器尝试执行,但在控制台中写入异常:
VM14379:7 Uncaught SyntaxError: Unexpected token ;
at eval (<anonymous>)
我单击该行并看到:
我说得对吗,因为< 被转义了?如何解决?
(edit:将其移至my-theme/layouts/index.html 会使代码从呈现的页面中完全消失。在layouts/_default/single.html 中仍会导致相同的错误。)
Hugo 版本是 0.21。
【问题讨论】:
标签: javascript mathjax hugo