-
Notifications
You must be signed in to change notification settings - Fork 220
Inline svglite SVGs in gt tables lose styles during Quarto HTML table processing #2135
Description
When gt tables containing inline SVG plots (from gtExtras functions like `gt_plt_dist()`, `gt_plt_sparkline()`, etc.) are rendered in Quarto HTML output, the density/sparkline plots get black backgrounds.
Cause
svglite embeds a `<style>` block inside each SVG's `` that sets `.svglite rect { fill: none }`. Quarto's HTML table processing passes the `
...</table>` HTML through Pandoc's HTML parser (`pandoc.read()`), which drops these `<style>` tags. Without the style rule, SVG rects revert to the spec default `fill: black`.gt's own CSS (the `<style>#id table { ... }` block) survives because it sits outside the `
| ` cells, so they get processed and lost.
Details and evidence in the Quarto issue: quarto-dev/quarto-cli#14285 Workarounds
Possible gt-side improvements
Reprexhttps://github.com/topepo/quarto-gt-reprex Any gt table using `gtExtras::gt_plt_dist()` rendered in Quarto HTML shows the issue. Reported with Quarto 1.9.32, gt 1.3.0, gtExtras 0.6.2. |