diff --git a/devtools/test_dashboard/index-mathjax3.html b/devtools/test_dashboard/index-mathjax3.html index 4520e05db9b..4402a03215a 100644 --- a/devtools/test_dashboard/index-mathjax3.html +++ b/devtools/test_dashboard/index-mathjax3.html @@ -1,7 +1,7 @@ - Plotly.js Devtools + Plotly.js Devtools - MathJax v3 loaded with svg output diff --git a/devtools/test_dashboard/index-mathjax3chtml.html b/devtools/test_dashboard/index-mathjax3chtml.html new file mode 100644 index 00000000000..968e32bfce9 --- /dev/null +++ b/devtools/test_dashboard/index-mathjax3chtml.html @@ -0,0 +1,159 @@ + + + + Plotly.js Devtools - MathJax v3 loaded with chtml output +

MathJax $V^3$ with $chtml$ output on the page and svg output on the plotly graphs

+ + + + +
+ + + + + +
+ +
+
+
+
+
+ + + + + + + + diff --git a/devtools/test_dashboard/server.js b/devtools/test_dashboard/server.js index 6820778b1b4..36bdd7dad4f 100644 --- a/devtools/test_dashboard/server.js +++ b/devtools/test_dashboard/server.js @@ -14,6 +14,7 @@ var args = minimist(process.argv.slice(2), {}); var PORT = args.port || 3000; var strict = args.strict; var mathjax3 = args.mathjax3; +var mathjax3chtml = args.mathjax3chtml; // Create server var server = http.createServer(ecstatic({ @@ -28,7 +29,8 @@ var bundlePlotly = makeWatchifiedBundle(strict, function() { // open up browser window on first bundle callback open('http://localhost:' + PORT + '/devtools/test_dashboard/index' + ( strict ? '-strict' : - mathjax3 ? '-mathjax3' : '' + mathjax3 ? '-mathjax3' : + mathjax3chtml ? '-mathjax3chtml' : '' ) + '.html'); }); diff --git a/package.json b/package.json index 95d729d9550..e2509d14681 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "test-plain-obj": "node tasks/test_plain_obj.js", "test": "npm run test-jasmine -- --nowatch && npm run test-bundle && npm run test-image && npm run test-export && npm run test-syntax && npm run lint", "mathjax3": "node devtools/test_dashboard/server.js --mathjax3", + "mathjax3chtml": "node devtools/test_dashboard/server.js --mathjax3chtml", "strict": "node devtools/test_dashboard/server.js --strict", "start": "node devtools/test_dashboard/server.js", "baseline": "node test/image/make_baseline.js", diff --git a/src/lib/svg_text_utils.js b/src/lib/svg_text_utils.js index 9e8b805bc3e..34124129539 100644 --- a/src/lib/svg_text_utils.js +++ b/src/lib/svg_text_utils.js @@ -178,8 +178,17 @@ function texToSVG(_texString, _config, _callback) { (MathJax.version || '').split('.')[0] ) || -1; + if(MathJax._mockedV2API) { + MathJaxVersion = 2; + } else if( + MathJaxVersion === 3 && + MathJax.config.startup.output === 'chtml' + ) { + Lib.warn('To use both chtml and svg outputs on the page you may consider mocking MathJax-v2 API as illustrated in devtools/test_dashboard/index-mathjax3chtml.html'); + } + if(!MathJaxVersion) { - Lib.log('No MathJax version:', MathJax.version); + Lib.warn('No MathJax version:', MathJax.version); } var originalRenderer,