diff --git a/pandas/io/formats/style.py b/pandas/io/formats/style.py index 6293ad6ae3ddf..432e12f303919 100644 --- a/pandas/io/formats/style.py +++ b/pandas/io/formats/style.py @@ -97,6 +97,15 @@ def _mpl(func: Callable): color = """color : str, default 'yellow' Background color to use for highlighting.""" +buf = """buf : str, path object, file-like object, optional + String, path object (implementing ``os.PathLike[str]``), or file-like + object implementing a string ``write()`` function. If ``None``, the result is + returned as a string.""" + +encoding = """encoding : str, optional + Character encoding setting for file output (and meta tags if available). + Defaults to ``pandas.options.styler.render.encoding`` value of "utf-8".""" + # ### @@ -1053,6 +1062,7 @@ def to_latex( latex, buf=buf, encoding=None if buf is None else encoding ) + @Substitution(buf=buf, encoding=encoding) def to_html( self, buf: FilePath | WriteBuffer[str] | None = None, @@ -1077,10 +1087,7 @@ def to_html( Parameters ---------- - buf : str, path object, file-like object, or None, default None - String, path object (implementing ``os.PathLike[str]``), or file-like - object implementing a string ``write()`` function. If None, the result is - returned as a string. + %(buf)s table_uuid : str, optional Id attribute assigned to the HTML element in the format: @@ -1127,9 +1134,7 @@ def to_html( which is 262144 (18 bit browser rendering). .. versionadded:: 1.4.0 - encoding : str, optional - Character encoding setting for file output, and HTML meta tags. - Defaults to ``pandas.options.styler.render.encoding`` value of "utf-8". + %(encoding)s doctype_html : bool, default False Whether to output a fully structured HTML file including all HTML elements, or just the core ``