diff --git a/.circleci/config.yml b/.circleci/config.yml index 6a2f771ed88..9804dd57802 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -89,7 +89,7 @@ jobs: environment: # Alaska time (arbitrary timezone to test date logic) TZ: "America/Anchorage" - parallelism: 8 + parallelism: 12 working_directory: ~/plotly.js steps: - browser-tools/install-browser-tools: &browser-versions @@ -216,6 +216,24 @@ jobs: name: Test MathJax on firefox-latest command: .circleci/test.sh mathjax-firefox82+ + make-baselines-mathjax3: + docker: + - image: circleci/python:3.8.9 + working_directory: ~/plotly.js + steps: + - attach_workspace: + at: ~/ + - run: + name: Install kaleido, plotly.io and required fonts + command: .circleci/env_image.sh + - run: + name: Create mathjax v3 png files + command: .circleci/test.sh make-baselines-mathjax3 + - persist_to_workspace: + root: ~/ + paths: + - plotly.js + make-baselines: parallelism: 4 docker: @@ -249,6 +267,20 @@ jobs: path: build destination: / + test-baselines-mathjax3: + docker: + - image: circleci/node:16.8.0 + working_directory: ~/plotly.js + steps: + - attach_workspace: + at: ~/ + - run: + name: Compare pixels of mathjax v3 baselines + command: .circleci/test.sh test-image-mathjax3 + - store_artifacts: + path: build + destination: / + make-exports: docker: - image: circleci/python:3.8.9 @@ -413,6 +445,12 @@ workflows: - flaky-no-gl-jasmine: requires: - install-and-cibuild + - make-baselines-mathjax3: + requires: + - install-and-cibuild + - test-baselines-mathjax3: + requires: + - make-baselines-mathjax3 - make-baselines: requires: - install-and-cibuild diff --git a/.circleci/test.sh b/.circleci/test.sh index 211b7bc2e69..ecb9b0649c7 100755 --- a/.circleci/test.sh +++ b/.circleci/test.sh @@ -75,7 +75,15 @@ case $1 in ;; mathjax-firefox82+) - ./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --skip-tags=noFF82 --bundleTest=mathjax --nowatch || EXIT_STATE=$? + ./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --bundleTest=mathjax --skip-tags=noFF82 --nowatch && + ./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --bundleTest=mathjax --mathjax3 --skip-tags=noFF82 --nowatch && + ./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --bundleTest=mathjax_config --mathjax3 --nowatch && + ./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --bundleTest=mathjax_config --nowatch || EXIT_STATE=$? + exit $EXIT_STATE + ;; + + make-baselines-mathjax3) + python3 test/image/make_baseline.py mathjax3 legend_mathjax_title_and_items mathjax parcats_grid_subplots table_latex_multitrace_scatter table_plain_birds table_wrapped_birds ternary-mathjax || EXIT_STATE=$? exit $EXIT_STATE ;; @@ -90,6 +98,11 @@ case $1 in exit $EXIT_STATE ;; + test-image-mathjax3) + node test/image/compare_pixels_test.js mathjax3 || { tar -cvf build/baselines.tar build/test_images/*.png ; exit 1 ; } || EXIT_STATE=$? + exit $EXIT_STATE + ;; + source-syntax) npm run lint || EXIT_STATE=$? npm run test-syntax || EXIT_STATE=$? diff --git a/README.md b/README.md index 1f82761abca..fbf90208ff1 100644 --- a/README.md +++ b/README.md @@ -87,11 +87,19 @@ While non-minified source files may contain characters outside UTF-8, it is reco > Please note that as of v2 the "plotly-latest" outputs (e.g. https://cdn.plot.ly/plotly-latest.min.js) will no longer be updated on the CDN, and will stay at the last v1 patch v1.58.5. Therefore, to use the CDN with plotly.js v2 and higher, you must specify an exact plotly.js version. -To support MathJax, you need to load version two of MathJax e.g. `v2.7.5` files from CDN or npm. +To support MathJax, you could load either version two or version three of MathJax files, for example: ```html ``` +```html + +``` + +> When using MathJax version 3, it is also possible to use `chtml` output on the other parts of the page in addition to `svg` output for the plotly graph. +Please refer to `devtools/test_dashboard/index-mathjax3chtml.html` to see an example. + + ## Bundles There are two kinds of plotly.js bundles: 1. Complete and partial official bundles that are distributed to `npm` and the `CDN`, described in [the dist README](https://github.com/plotly/plotly.js/blob/master/dist/README.md). diff --git a/devtools/test_dashboard/index-mathjax3.html b/devtools/test_dashboard/index-mathjax3.html new file mode 100644 index 00000000000..1c56ae3001f --- /dev/null +++ b/devtools/test_dashboard/index-mathjax3.html @@ -0,0 +1,43 @@ + + +
+MathJax $V^3$ with $svg$ output on the page as well as plotly graphs
+MathJax $V^3$ with $chtml$ output on the page and svg output on the plotly graphs
+