Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions plotly/io/_base_renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def activate(self):

if self.connected:
script = """\
<script type="text/javascript">
<script>
{win_config}
{mathjax_config}
</script>
Expand All @@ -288,7 +288,7 @@ def activate(self):
# If not connected then we embed a copy of the plotly.js
# library in the notebook
script = """\
<script type="text/javascript">
<script>
{win_config}
{mathjax_config}
</script>
Expand Down
8 changes: 4 additions & 4 deletions plotly/io/_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ def _generate_sri_hash(content):
# Build script to set global PlotlyConfig object. This must execute before
# plotly.js is loaded.
_window_plotly_config = """\
<script type="text/javascript">\
<script>\
window.PlotlyConfig = {MathJaxConfig: 'local'};\
</script>"""

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

Expand Down Expand Up @@ -282,7 +282,7 @@ def to_html(
elif include_plotlyjs:
load_plotlyjs = """\
{win_config}
<script type="text/javascript">{plotlyjs}</script>\
<script>{plotlyjs}</script>\
""".format(win_config=_window_plotly_config, plotlyjs=get_plotlyjs())

# ## Handle loading/initializing MathJax ##
Expand Down Expand Up @@ -323,7 +323,7 @@ def to_html(
{load_plotlyjs}\
<div id="{id}" class="plotly-graph-div" \
style="height:{height}; width:{width};"></div>\
<script type="text/javascript">\
<script>\
window.PLOTLYENV=window.PLOTLYENV || {{}};{base_url_line}\
{script};\
</script>\
Expand Down
8 changes: 4 additions & 4 deletions plotly/offline/offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def get_plotlyjs():
>>> html = '''
... <html>
... <head>
... <script type="text/javascript">{plotlyjs}</script>
... <script>{plotlyjs}</script>
... </head>
... <body>
... {div1}
Expand All @@ -89,7 +89,7 @@ def get_plotlyjs():

def _build_resize_script(plotdivid, plotly_root="Plotly"):
resize_script = (
'<script type="text/javascript">'
"<script>"
'window.addEventListener("resize", function(){{'
'if (document.getElementById("{id}")) {{'
'{plotly_root}.Plots.resize(document.getElementById("{id}"));'
Expand Down Expand Up @@ -177,12 +177,12 @@ def _get_jconfig(config=None):
# Build script to set global PlotlyConfig object. This must execute before
# plotly.js is loaded.
_window_plotly_config = """\
<script type="text/javascript">\
<script>\
window.PlotlyConfig = {MathJaxConfig: 'local'};\
</script>"""

_mathjax_config = """\
<script type="text/javascript">\
<script>\
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 tests/test_core/test_offline/test_offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
PLOTLYJS = plotly.offline.get_plotlyjs()

plotly_config_script = """\
<script type="text/javascript">\
<script>\
window.PlotlyConfig = {MathJaxConfig: 'local'};</script>"""

cdn_script = '<script charset="utf-8" src="{cdn_url}" integrity="{js_hash}" crossorigin="anonymous"></script>'.format(
Expand Down
4 changes: 2 additions & 2 deletions tests/test_io/test_renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,15 +306,15 @@ def test_repr_html(renderer):
sri_hash = _generate_sri_hash(plotlyjs_content)

template = (
'<div> <script type="text/javascript">'
"<div> <script>"
"window.PlotlyConfig = {MathJaxConfig: 'local'};</script>\n "
'<script charset="utf-8" src="'
+ plotly_cdn_url()
+ '" integrity="'
+ sri_hash
+ '" crossorigin="anonymous"></script> '
'<div id="cd462b94-79ce-42a2-887f-2650a761a144" class="plotly-graph-div" '
'style="height:100%; width:100%;"></div> <script type="text/javascript">'
'style="height:100%; width:100%;"></div> <script>'
" window.PLOTLYENV=window.PLOTLYENV || {};"
' if (document.getElementById("cd462b94-79ce-42a2-887f-2650a761a144"))'
' { Plotly.newPlot( "cd462b94-79ce-42a2-887f-2650a761a144",'
Expand Down