该片段发布在 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>)
我单击该行并看到以下内容:
我说得对吗,因为<
被逃跑了?如何解决?
(编辑:移动它以my-theme/layouts/index.html
使代码完全从呈现的页面中消失。layouts/_default/single.html
它仍然会导致相同的错误。)
Hugo 版本是 0.21。