Skip to content

Commit ee8e521

Browse files
Load MathJax config dynamically
1 parent 88ed245 commit ee8e521

File tree

5 files changed

+55
-79
lines changed

5 files changed

+55
-79
lines changed

dist/markjax.js

+26-47
Large diffs are not rendered by default.

dist/markjax.min.js

+2-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@
3939
var preview = document.getElementById("output");
4040
markjax(textarea.value, preview);
4141
}
42-
43-
render()
42+
render();
4443
</script>
4544
</body>
4645
</html>

js/markjax.js

+24-24
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
(function () {
2-
var script = document.createElement("script");
3-
script.type = "text/javascript";
4-
script.src = "http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
5-
document.getElementsByTagName("head")[0].appendChild(script);
6-
})();
1+
var head = document.getElementsByTagName("head")[0], script;
2+
script = document.createElement("script");
3+
script.type = "text/x-mathjax-config";
4+
script[(window.opera ? "innerHTML" : "text")] =
5+
"MathJax.Hub.Config({" +
6+
" showProcessingMessages: false," +
7+
" messageStyle: \"none\"," +
8+
" tex2jax: {" +
9+
" inlineMath: [['$','$']]," +
10+
" displayMath: [['$$', '$$']]," +
11+
" ignoreClass: \".*\"," +
12+
" processClass: \"mathjax\"" +
13+
" }," +
14+
" TeX: {" +
15+
" equationNumbers: {" +
16+
" autoNumber: \"AMS\"" +
17+
" }" +
18+
" }" +
19+
"});";
20+
head.appendChild(script);
21+
script = document.createElement("script");
22+
script.type = "text/javascript";
23+
script.src = "http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
24+
head.appendChild(script);
725

826
var marked = require("marked");
9-
require("mathjax");
10-
11-
MathJax.Hub.Config({
12-
showProcessingMessages: false,
13-
messageStyle: "none",
14-
skipStartupTypeset: true,
15-
tex2jax: {
16-
inlineMath: [['$','$']],
17-
displayMath: [['$$', '$$']],
18-
ignoreClass: ".*",
19-
processClass: "mathjax"
20-
},
21-
TeX: {
22-
equationNumbers: {
23-
autoNumber: "AMS"
24-
}
25-
}
26-
});
2727

2828
marked.setOptions({
2929
breaks: true,

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "markjax",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"description": "Javascript parser for converting Markdown with LaTeX to HTML",
55
"keywords": [
66
"parser",
@@ -11,7 +11,7 @@
1111
],
1212
"homepage": "http://markjax.codeassign.com/",
1313
"main": "./js/markjax.js",
14-
"license": "Apache 2.0",
14+
"license": "Apache-2.0",
1515
"company": "CodeAssign",
1616
"author": {
1717
"name": "Herman Zvonimir Došilović",

0 commit comments

Comments
 (0)