diff --git a/packages/python/plotly/plotly/io/_html.py b/packages/python/plotly/plotly/io/_html.py index f2f4aba0ef1..72015d107bd 100644 --- a/packages/python/plotly/plotly/io/_html.py +++ b/packages/python/plotly/plotly/io/_html.py @@ -230,14 +230,14 @@ def to_html( # Serialize config dict to JSON jconfig = json.dumps(config) - script = """ - if (document.getElementById("{id}")) {{ - Plotly.newPlot( - '{id}', - {data}, - {layout}, - {config} - ){then_addframes}{then_animate}{then_post_script} + script = """\ + if (document.getElementById("{id}")) {{\ + Plotly.newPlot(\ + "{id}",\ + {data},\ + {layout},\ + {config}\ + ){then_addframes}{then_animate}{then_post_script}\ }}""".format( id=plotdivid, data=jdata, @@ -333,25 +333,24 @@ def to_html( Invalid value of type {typ} received as the include_mathjax argument Received value: {val} -include_mathjax may be specified as False, 'cdn', or a string ending with '.js' +include_mathjax may be specified as False, 'cdn', or a string ending with '.js' """.format( typ=type(include_mathjax), val=repr(include_mathjax) ) ) plotly_html_div = """\ -