great-tables
great-tables copied to clipboard
Optimize HTML size for email (custom default styles?)
Prework
- [x] Read and abide by the great_tables code of conduct and contributing guidelines. — the CONTRIBUTING link is 404 though
- [x] Search for duplicates among the existing issues (both open and closed).
Proposal
When using gt.as_raw_html(inline_css=True) to send the table in email (https://github.com/posit-dev/great-tables/issues/138), each cell contains repeated (and verbose) styles:
<td class="gt_row gt_left"
style="border-style: none;
padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px;
margin: 10px;
border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3;
border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3;
border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3;
vertical-align: middle;
overflow-x: hidden;
text-align: left;
">
this leads to "message clipped" in popular clients (e.g. Gmail), as the message quickly becomes larger than 102KB.
I was thinking about overriding the default styles with my own to avoid this problem, but they seem to be hard-coded: https://github.com/posit-dev/great-tables/blob/e4e1ec4d75e44fc2f173457a065914290217746a/great_tables/_scss.py#L166C5-L166C22