MathJax 中配置选项中有趣的 javascript 代码
据我所知,javascript 代码可以“定义”为文件
<script type="text/javascript" src="script.js"></script>
或内联代码
<script type="text/javascript">
....
// some more code
....
</script>
那么,这是如何完成的?尽管如此,这是 javascript 代码!?!
<script type="text/javascript" src="MathJax.js">
MathJax.Hub.Config({
extensions: ["tex2jax.js", "mml2jax.js"],
jax: ["input/Tex", "input/MathML", "output/HTML-CSS"]
});
</script>
视频配置 MathJax
As far as I know the javascript code can be "defined" as file
<script type="text/javascript" src="script.js"></script>
or as inline code
<script type="text/javascript">
....
// some more code
....
</script>
So, how this is done ? Nevertheless this is javascript code !?!
<script type="text/javascript" src="MathJax.js">
MathJax.Hub.Config({
extensions: ["tex2jax.js", "mml2jax.js"],
jax: ["input/Tex", "input/MathML", "output/HTML-CSS"]
});
</script>
Video configuring MathJax
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
(通过使用 Chrome 的开发工具查看 MathJax 演示发现)
它以编程方式创建新的
标记并将它们放置在
标记内,就像 < a href="http://requirejs.org/" rel="nofollow">http://requirejs.org/ 或 http://headjs.com/ 确实如此。
类似的事情
当
MathJax.Hub.Config()
执行时,会发生。 编辑: head.js 和 require.js 当然需要更多的花哨功能。
(Found out from looking at MathJax demos with Chrome's developer tools)
It's programmatically creating new
<script>
tags and places them inside the<head>
tag, rather like http://requirejs.org/ or http://headjs.com/ does.Something along the lines of
happens when
MathJax.Hub.Config()
executes.Edit: head.js and require.js does it with rather a lot more bells and whistles, of course.
这只是一些无效的标记。规范摘录如下(请注意使用必须而不是应该):
This is just some invalid markup. Excerpt from specs follows (note the usage of must rather than should):