Skip to content

.to_html() method produces incorrectly formatted <div> element string for full_html=False option #2468

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tallamjr opened this issue May 14, 2020 · 0 comments · Fixed by #2469

Comments

@tallamjr
Copy link
Contributor

tallamjr commented May 14, 2020

When one invokes plotly.io.to_html(fig, include_plotlyjs=False, full_html=False) the following
example output is produced:

'<div>\n        \n        \n            <div id="8a9f01d7-9e37-401b-a602-15b3bbdac943"
class="plotly-graph-div" style="height:100%; width:100%;"></div>\n            <script
type="text/javascript">\n                \n                    window.PLOTLYENV=window.PLOTLYENV ||
{};\n                    \n                if
(document.getElementById("8a9f01d7-9e37-401b-a602-15b3bbdac943")) {\n
Plotly.newPlot(\n                        \'8a9f01d7-9e37-401b-a602-15b3bbdac943\',\n
...

Note the \n characters as well as a single quoted id.

The resulting <div> element appears like this when placed in a markdown document, i.e no plot
showing up:
image

Note I have ensured to include:

<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>

above the <div> element.

Removing the \n characters and replacing the single quoted id with double quotes seems to
resolve this issue.

See PR #2469

@tallamjr tallamjr changed the title .to_html() method produces incorrectly formatted <div> element string for full_htmlk=False option .to_html() method produces incorrectly formatted <div> element string for full_html=False option May 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant