rstudio / gt

Easily generate information-rich, publication-quality tables from R
https://gt.rstudio.com
Other
2.01k stars 204 forks source link

gt table in Xaringan slide - Footnotes are broken in versions 0.8.0 and 0.9.0. #1409

Open hjoddi opened 1 year ago

hjoddi commented 1 year ago

Description

When using a gt table as part of a Xaringan html slide presentation, adding footnotes with tab_footnotes() stopped working in version 0.8.0, and doesn't work in 0.9.0 either. It last worked in version 0.7.0. It doesn't matter which Xaringan version is used.

The problem presents itself as 1">Name1 (the 1s are in superscript) when creating a footnote, 1, at the Name column. See pictures below.

Reproducible example

This is the R code. "---" represents the start of a new slide in Xaringan.

---
### My slide title

```{r echo=FALSE}
my_test_data <- data.frame(
  Name = c("Alice", "Bob", "Charlie"),
  Age = c(25, 30, 28),
  Score = c(95, 85, 90)
)

my_test_data %>%
  gt() %>%
  tab_footnote(
    footnote = "Test footnote.",
    locations = cells_column_labels(columns = Name)
  )
"```" # Note that the quote marks are added to prevent closing the code block. They're not in the actual R code.
---

This is the table as generated using gt version 0.7.0:

gt_070

This is the table as generated using gt version 0.8.0:

gt_080

This is the table as generated using gt version 0.9.0:

gt_090

Expected result

The expected outcome is a table as generated using version 0.7.0:

gt_070
olivroy commented 2 months ago

Is this still an issue with gt 0.11?