Why the following works for caption and doesn't for footnote? How do i do that in the footer?
library(kableExtra)
mtcars[1:5,] %>%
kable(caption = "why this <span style='color: red;'>is red</span>") %>%
footnote(general_title = "",
general = "and this<span style='color: red;'>isn't?</span>")
By default, the escape
parameter is set to TRUE
in footnote
. This means that any html that you try to include in your footnote will be html-escaped and therefore it will be rendered as a string rather than being interpreted as actual html.
Fortunately, you can just turn it off:
library(kableExtra)
mtcars[1:5,] %>%
kable(caption = "why this <span style='color: red;'>is red</span>") %>%
footnote(general_title = "",
general = "and this<span style='color: red;'> is too?</span>",
escape = FALSE)