diff --git a/CHANGELOG.md b/CHANGELOG.md index adcd44308da..4f4cc3ac0ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Fixed - Fix `hex_to_rgb` parsing of 3-digit shorthand hexadecimal colors such as `#FFF` [[#5662](https://github.com/plotly/plotly.py/pull/5662)], with thanks to @genrichez for the contribution! +- Add `` to the `to_html()` template to comply with modern web standards [[#5693](https://github.com/plotly/plotly.py/pull/5693)], with thanks to @mishrakushal for the contribution! ## [6.9.0] - 2026-07-09 diff --git a/plotly/io/_html.py b/plotly/io/_html.py index c2153dc5b0b..68c9bf38d36 100644 --- a/plotly/io/_html.py +++ b/plotly/io/_html.py @@ -339,8 +339,12 @@ def to_html( if full_html: return """\ + -
+ + + + {div} diff --git a/tests/test_core/test_offline/test_offline.py b/tests/test_core/test_offline/test_offline.py index 791fb7c6460..5bf185a7d9e 100644 --- a/tests/test_core/test_offline/test_offline.py +++ b/tests/test_core/test_offline/test_offline.py @@ -108,7 +108,7 @@ def test_default_plot_generates_expected_html(self): self.assertIn(plotly_config_script, html) # so is config self.assertIn(PLOTLYJS, html) # and the source code # and it's an doc - self.assertTrue(html.startswith("") and html.endswith("")) + self.assertTrue(html.startswith("") and html.endswith("")) def test_including_plotlyjs_truthy_html(self): # For backwards compatibility all truthy values that aren't otherwise diff --git a/tests/test_io/test_renderers.py b/tests/test_io/test_renderers.py index 521b9447735..b1019b82499 100644 --- a/tests/test_io/test_renderers.py +++ b/tests/test_io/test_renderers.py @@ -133,11 +133,11 @@ def test_plotly_mimetype_renderer_show(fig1, renderer): # HTML # ---- def assert_full_html(html): - assert html.startswith(" doc - self.assertTrue(html.startswith("") and html.endswith("")) + self.assertTrue( + html.startswith("") and html.endswith("") + )