Skip to content

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

Open
@cjerdonek

Description

@cjerdonek

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2considered for next cyclefeaturesomething new

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions