Skip to content

email output of gt table using blastula has raw html included with formatted table (issue with version 0.9.0+) #1506

Description

@kristymazoo

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

  • Post a minimal reproducible example so the maintainer can troubleshoot the problems you identify. A reproducible example is:
    • Runnable: post enough R code and data so any onlooker can create the error on their own computer.
    • Minimal: reduce runtime wherever possible and remove complicated details that are irrelevant to the issue at hand.
    • Readable: format your code according to the tidyverse style guide.
library(blastula)
library(stringr)
library(htmltools)
library(tidyverse)
library(gt)
#> 
#> Attaching package: 'gt'
#> The following object is masked from 'package:blastula':
#> 
#>     md

tbl <- gt::gt(mtcars %>% head(5)) %>% 
  gt::as_raw_html()
email_body <- md(
  c("Hello all!\n", 
    tbl, "\n",
    "Thank you.")
  )

(body <- compose_email(body = email_body))

Created on 2023-12-08 with reprex v2.0.2

using gt v0.9.0
image

Expected result

using gt v0.8.0
image

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.

> sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.6 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] gt_0.9.0        lubridate_1.9.3 forcats_1.0.0   dplyr_1.1.3     purrr_1.0.2     readr_2.1.4     tidyr_1.3.0    
 [8] tibble_3.2.1    ggplot2_3.4.4   tidyverse_2.0.0 htmltools_0.5.7 stringr_1.5.0   blastula_0.3.4 

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.11       compiler_4.2.2    pillar_1.9.0      tools_4.2.2       digest_0.6.33     timechange_0.2.0 
 [7] jsonlite_1.8.7    lifecycle_1.0.4   gtable_0.3.4      lattice_0.20-45   pkgconfig_2.0.3   png_0.1-8        
[13] rlang_1.1.2       Matrix_1.5-1      cli_3.6.1         rstudioapi_0.15.0 commonmark_1.9.0  curl_5.1.0       
[19] fastmap_1.1.1     xml2_1.3.5        withr_2.5.2       sass_0.4.7        hms_1.1.3         generics_0.1.3   
[25] vctrs_0.6.4       rappdirs_0.3.3    tidyselect_1.2.0  rprojroot_2.0.4   grid_4.2.2        juicyjuice_0.1.0 
[31] reticulate_1.34.0 glue_1.6.2        here_1.0.1        R6_2.5.1          fansi_1.0.5       tzdb_0.4.0       
[37] magrittr_2.0.3    scales_1.2.1      colorspace_2.1-0  V8_4.4.0          utf8_1.2.4        stringi_1.7.12   
[43] munsell_0.5.0    

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions