diff --git a/great_tables/_export.py b/great_tables/_export.py index cebb082a3..e5f0183e3 100644 --- a/great_tables/_export.py +++ b/great_tables/_export.py @@ -9,8 +9,11 @@ from pathlib import Path from typing import TYPE_CHECKING, Literal +from css_inline import inline, inline_fragment from typing_extensions import TypeAlias +from ._helpers import random_id +from ._scss import compile_scss from ._utils import _try_import from ._utils_render_latex import _render_as_latex @@ -126,19 +129,29 @@ def show( def as_raw_html( self: GT, + inline_css: bool = False, make_page: bool = False, all_important: bool = False, ) -> str: """ Get the HTML content of a GT object. - Get the HTML content from a GT object as a string. This function is useful for obtaining the - HTML content of a GT object for use in other contexts. + Get the HTML content from a GT object as a string. By default, the generated HTML will have + inlined styles, where CSS styles (that were previously contained in CSS rule sets external to + the `` element are included as style attributes in the HTML table's tags. This option is + preferable when using the output HTML table in an emailing context. Parameters ---------- gt A GT object. + inline_css + An option to supply styles to table elements as inlined CSS styles. This is useful when + including the table HTML as part of an HTML email message body, since inlined styles are + largely supported in email clients over using CSS in a `