5

Blastula appears to not respect the <style> tags used by table formatting packages like kableextra and formattable.

Example:

library(kableExtra)
library(blastula)

dt <- mtcars[1:5, 1:6]

tbl <- dt %>%
  kbl() %>%
  kable_styling()

tbl

compose_email(
  body = md(c(
    "this is my table:",
    tbl
    )))

Displays this when printing tbl

enter image description here

But this when printing compose_email

enter image description here

I think this is because blastula just prints the table, and the kableextra formatting is somewhere else using the class:

tbl <- dt %>%
  kbl("html")

tbl_styled <- tbl %>%
  kable_styling()

as.character(tbl)
as.character(tbl_styled)

This shows that the only difference when printing the styled tbl is the <table> tag:

<table class=\"table\" style=\"margin-left: auto; margin-right: auto;\">

So I suppose the only way would be to write our own table parser that puts the style inline? Unless there's already an R package that does this?

Ryan Knight
  • 1,288
  • 1
  • 11
  • 18

0 Answers0