Skip to content

Commit

Permalink
Merge pull request #3706 from plotly/fixup-mathjax-v2-config
Browse files Browse the repository at this point in the history
fix setting config for MathJax v2 - ensure version 2 Hub
  • Loading branch information
nicolaskruchten authored May 3, 2022
2 parents 6018bff + 13f7c91 commit cbfa30d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
6 changes: 2 additions & 4 deletions packages/javascript/jupyterlab-plotly/src/Figure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -826,11 +826,9 @@ export class FigureView extends DOMWidgetView {
this.model.on("change:_py2js_update", this.do_update, this);
this.model.on("change:_py2js_animate", this.do_animate, this);

// MathJax configuration
// MathJax v2 configuration
// ---------------------
if ((window as any).MathJax) {
(window as any).MathJax.Hub.Config({ SVG: { font: "STIX-Web" } });
}
(window as any)?.MathJax?.Hub?.Config?.({ SVG: { font: "STIX-Web" } });

// Get message ids
// ---------------------
Expand Down
2 changes: 1 addition & 1 deletion packages/python/plotly/plotly/io/_base_renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def __init__(self, width=None, height=None, scale=None, engine="auto"):
window.PlotlyConfig = {MathJaxConfig: 'local'};"""

_mathjax_config = """\
if (window.MathJax) {MathJax.Hub.Config({SVG: {font: "STIX-Web"}});}"""
if (window.MathJax && window.MathJax.Hub && window.MathJax.Hub.Config) {window.MathJax.Hub.Config({SVG: {font: "STIX-Web"}});}"""


class HtmlRenderer(MimetypeRenderer):
Expand Down
2 changes: 1 addition & 1 deletion packages/python/plotly/plotly/io/_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

_mathjax_config = """\
<script type="text/javascript">\
if (window.MathJax) {MathJax.Hub.Config({SVG: {font: "STIX-Web"}});}\
if (window.MathJax && window.MathJax.Hub && && window.MathJax.Hub.Config) {window.MathJax.Hub.Config({SVG: {font: "STIX-Web"}});}\
</script>"""


Expand Down
2 changes: 1 addition & 1 deletion packages/python/plotly/plotly/offline/offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def _get_jconfig(config=None):

_mathjax_config = """\
<script type="text/javascript">\
if (window.MathJax) {MathJax.Hub.Config({SVG: {font: "STIX-Web"}});}\
if (window.MathJax && window.MathJax.Hub && window.MathJax.Hub.Config) {window.MathJax.Hub.Config({SVG: {font: "STIX-Web"}});}\
</script>"""


Expand Down

0 comments on commit cbfa30d

Please sign in to comment.