Skip to content
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

Allow (or switch to) generating html that starts with <!doctype html> when using to_html(full_html=True) #4847

Open
cjerdonek opened this issue Nov 3, 2024 · 0 comments
Labels
feature something new P2 considered for next cycle

Comments

@cjerdonek
Copy link

Currently, plotly.py's to_html() function (when using the default full_html=True argument) generates html that doesn't start with a required doctype (i.e. <!doctype html>). It would be good to support this, or switch to doing this.

The code can be found here:

if full_html:
return """\
<html>
<head><meta charset="utf-8" /></head>
<body>
{div}
</body>
</html>""".format(
div=plotly_html_div
)

The reason I noticed this is that some plots I'm working with were formatted differently when I used full_html=False to include a plot into another html document that did start with <!doctype html>. I narrowed the reason for this difference in formatting down to the presence or absence of that single line. Since plots can be included into html with or without a doctype, it would probably be good to be aware of this difference.

@gvwilson gvwilson added feature something new P2 considered for next cycle labels Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new P2 considered for next cycle
Projects
None yet
Development

No branches or pull requests

2 participants