Closed dennisbrookner closed 2 years ago
Gotcha! Good to hear it can embed in external sites - I'll explore this a bit more and come back to the FR.
Ah I just realized you're wanting updates to gtsave()
- that is a gt
function, as such you should post that as a Feature Request/issue on the gt
repo. Thanks!
Hey Thomas - love this package!
Issue
gtsave()
HTML outputs are intended to be stand-alone HTML pages, and as such, are not suitable for being embedded into other HTML webpages. Specifically:<!DOCTYPE html>
at the top, which when embedding onto another page (at least in jekyll) just gets passed through and printed as text<style>body{background-color:white;}</style>
tag overrides the parent page's background colorThere may also be other formatting things I'm not thinking of!
Proposed solution
An optional argument to
gtsave()
, e.g.for_embedding = TRUE
that provides an HTML chunk suitable for embedding rather than being its own page. I imagine that this is a pretty small change, and I'm happy to tackle it myself!My current workaround
I recently used
gt
andgtExtras
to make this table (https://puntalytics.github.io/gallery.html) on my website, using this github action (https://github.com/Puntalytics/Puntalytics.github.io/blob/master/.github/workflows/gttable.yml) and this script (https://github.com/Puntalytics/Puntalytics.github.io/blob/master/tables/tableworkflow.R). In this workflow, I justgrep
out the two problematic lines I mentioned above. It was an easy fix, but because this seems like it might be a common use case, I figure it makes sense to whip up a solution directly.And of course, if there is already a way to address this in the package, my bad!