diff --git a/xarray/core/formatting_html.py b/xarray/core/formatting_html.py index 69832d6ca3d..c99683e91c7 100644 --- a/xarray/core/formatting_html.py +++ b/xarray/core/formatting_html.py @@ -20,7 +20,9 @@ def short_data_repr_html(array): internal_data = getattr(array, "variable", array)._data if hasattr(internal_data, "_repr_html_"): return internal_data._repr_html_() - return escape(short_data_repr(array)) + else: + text = escape(short_data_repr(array)) + return f"
{text}" def format_dims(dims, coord_names): @@ -123,7 +125,7 @@ def summarize_variable(name, var, is_index=False, dtype=None, preview=None): f"" f"
{data_repr}" + f"
{data_repr}" + f"
array") def test_short_data_repr_html_non_str_keys(dataset):