-
Notifications
You must be signed in to change notification settings - Fork 214
email output of gt table using blastula has raw html included with formatted table (issue with version 0.9.0+) #1506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for reporting this! This will be fixed shortly. |
I'm still experiencing this issue (or one very similar), using
I copied and pasted the example code above:
And my result shows a very wide preview... here's the left side (ha!): |
Hi @Nova-Scotia this is fixed by updating gt to using the in-development version. Could you install that with devtools::install_github("rstudio/gt") and try the email generation again? We're going to submit gt to CRAN soon, so this problem should go away when using a CRAN version of gt. |
@rich-iannone thanks. That did the trick. |
That’s great to hear! |
I have encountered a variant of this issue in Here I adapt the reprex posted in this issue's original description: library(blastula)
library(glue)
library(gt)
#>
#> Attaching package: 'gt'
#> The following object is masked from 'package:blastula':
#>
#> md
library(stringr)
tbl <-
mtcars |>
head() |>
gt() |>
# Adding a header to the table produces the issue
tab_header("Motor Trend cars") |>
as_raw_html()
email_body <- " Hello all! {tbl} Thank you."
email_body |>
glue() |>
# Removing whitespace resolves the issue
# stringr::str_squish() |>
md() |>
compose_email() Created on 2024-02-05 with reprex v2.1.0 Session infosessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.3.1 (2023-06-16)
#> os macOS Sonoma 14.1
#> system x86_64, darwin20
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> ctype en_US.UTF-8
#> tz America/Los_Angeles
#> date 2024-02-05
#> pandoc 3.1.1 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/ (via rmarkdown)
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> blastula * 0.3.4 2023-09-23 [1] CRAN (R 4.3.0)
#> cli 3.6.2 2023-12-11 [1] CRAN (R 4.3.0)
#> commonmark 1.9.1 2024-01-30 [1] CRAN (R 4.3.2)
#> curl 5.2.0 2023-12-08 [1] CRAN (R 4.3.0)
#> digest 0.6.34 2024-01-11 [1] CRAN (R 4.3.0)
#> dplyr 1.1.4 2023-11-17 [1] CRAN (R 4.3.0)
#> evaluate 0.23 2023-11-01 [1] CRAN (R 4.3.0)
#> fansi 1.0.6 2023-12-08 [1] CRAN (R 4.3.0)
#> fastmap 1.1.1 2023-02-24 [1] CRAN (R 4.3.0)
#> fs 1.6.3 2023-07-20 [1] CRAN (R 4.3.0)
#> generics 0.1.3 2022-07-05 [1] CRAN (R 4.3.0)
#> glue * 1.7.0 2024-01-09 [1] CRAN (R 4.3.0)
#> gt * 0.10.1 2024-01-17 [1] CRAN (R 4.3.0)
#> htmltools 0.5.7 2023-11-03 [1] CRAN (R 4.3.0)
#> jsonlite 1.8.8 2023-12-04 [1] CRAN (R 4.3.0)
#> juicyjuice 0.1.0 2022-11-10 [1] CRAN (R 4.3.0)
#> knitr 1.45 2023-10-30 [1] CRAN (R 4.3.1)
#> lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.3.0)
#> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.3.0)
#> pillar 1.9.0 2023-03-22 [1] CRAN (R 4.3.0)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.3.0)
#> R6 2.5.1 2021-08-19 [1] CRAN (R 4.3.0)
#> Rcpp 1.0.12 2024-01-09 [1] CRAN (R 4.3.0)
#> reprex 2.1.0 2024-01-11 [1] CRAN (R 4.3.0)
#> rlang 1.1.3 2024-01-10 [1] CRAN (R 4.3.0)
#> rmarkdown 2.25 2023-09-18 [1] CRAN (R 4.3.0)
#> rstudioapi 0.15.0 2023-07-07 [1] CRAN (R 4.3.0)
#> sass 0.4.8 2023-12-06 [1] CRAN (R 4.3.0)
#> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.3.0)
#> stringi 1.8.3 2023-12-11 [1] CRAN (R 4.3.0)
#> stringr * 1.5.1 2023-11-14 [1] CRAN (R 4.3.0)
#> tibble 3.2.1 2023-03-20 [1] CRAN (R 4.3.0)
#> tidyselect 1.2.0 2022-10-10 [1] CRAN (R 4.3.0)
#> utf8 1.2.4 2023-10-22 [1] CRAN (R 4.3.0)
#> V8 4.4.1 2023-12-04 [1] CRAN (R 4.3.0)
#> vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.3.0)
#> withr 3.0.0 2024-01-16 [1] CRAN (R 4.3.0)
#> xfun 0.41 2023-11-01 [1] CRAN (R 4.3.0)
#> xml2 1.3.6 2023-12-04 [1] CRAN (R 4.3.0)
#> yaml 2.3.8 2023-12-11 [1] CRAN (R 4.3.0)
#>
#> [1] /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library
#>
#> ────────────────────────────────────────────────────────────────────────────── Thank you, Rich, for your work on this fantastic pair of packages. |
The header issue was affecting me as well. Thank you @stevensmallberg for the quick fix. |
Prework
Description
When adding a gt table to email body via blastula, the output now shows raw html in addition to the table instead of just the formatted output. It was working fine in v0.8.0 but doesn't work from v0.9.0 and up.
Reproducible example
Created on 2023-12-08 with reprex v2.0.2
using gt v0.9.0

Expected result
using gt v0.8.0

Session info
End the reproducible example with a call to
sessionInfo()
in the same session (e.g.reprex(session_info = TRUE)
) and include the output.The text was updated successfully, but these errors were encountered: