[quarto] tables with `fmt_markdown` don't render in quarto dashboard
Prework
- [x] Read and agree to the code of conduct and contributing guidelines.
- [x] If there is already a relevant issue, whether open or closed, comment on the existing thread instead of posting a new issue.
Description
I have a quarto dashboard, converted from an html file, in which some but not all gt tables fail to render. I was able to isolate the behavior only to those tables using fmt_markdown. In all my exmaples, the markdown string includes a <br/>. I'm not sure if this extends to other contents.
Reproducible example
- [x] Post a minimal reproducible example so the maintainer can troubleshoot the problems you identify. A reproducible example is:
- [x] Runnable: post enough R code and data so any onlooker can create the error on their own computer.
- [x] Minimal: reduce runtime wherever possible and remove complicated details that are irrelevant to the issue at hand.
- [x] Readable: format your code according to the tidyverse style guide.
---
title: "test-gt-markdown"
format: dashboard
---
# with markdown
## row
```{r}
#| title: with markdown
library(gt)
library(dplyr)
library(glue)
h <- head(sp500, n = 3) |>
mutate(test = glue::glue('{LETTERS[row_number()]}<br/>test')) |>
gt() |>
fmt_markdown(columns = c(test))
h
```
# session
```{r}
sessioninfo::session_info()
```
Expected result
I expected the table to render within the card. Instead, the rendered document is blank.
Session info
I'm using quarto version: 1.4.551
sessioninfo::session_info()
─ Session info ───────────────────────────────────────────────────────────────
setting value
version R version 4.3.2 (2023-10-31)
os macOS Sonoma 14.3
system aarch64, darwin20
ui X11
language (EN)
collate en_US.UTF-8
ctype en_US.UTF-8
tz America/New_York
date 2024-03-11
pandoc 3.1.1 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/ (via rmarkdown)
─ Packages ───────────────────────────────────────────────────────────────────
package * version date (UTC) lib source
cli 3.6.2 2023-12-11 [1] CRAN (R 4.3.1)
commonmark 1.9.1 2024-01-30 [1] CRAN (R 4.3.1)
digest 0.6.34 2024-01-11 [1] CRAN (R 4.3.1)
dplyr * 1.1.4 2023-11-17 [1] CRAN (R 4.3.1)
evaluate 0.23 2023-11-01 [1] CRAN (R 4.3.1)
fansi 1.0.6 2023-12-08 [1] CRAN (R 4.3.1)
fastmap 1.1.1 2023-02-24 [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.1)
gt * 0.10.1 2024-01-17 [1] CRAN (R 4.3.1)
htmltools 0.5.7 2023-11-03 [1] CRAN (R 4.3.1)
htmlwidgets 1.6.4 2023-12-06 [1] CRAN (R 4.3.1)
jsonlite 1.8.8 2023-12-04 [1] CRAN (R 4.3.1)
knitr 1.45 2023-10-30 [1] CRAN (R 4.3.1)
lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.3.1)
magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.3.0)
markdown 1.12 2023-12-06 [1] CRAN (R 4.3.1)
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)
rlang 1.1.3 2024-01-10 [1] CRAN (R 4.3.1)
rmarkdown 2.26 2024-03-05 [1] CRAN (R 4.3.1)
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.1)
sessioninfo 1.2.2 2021-12-06 [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.1)
vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.3.1)
withr 3.0.0 2024-01-16 [1] CRAN (R 4.3.1)
xfun 0.42 2024-02-08 [1] CRAN (R 4.3.1)
xml2 1.3.6 2023-12-04 [1] CRAN (R 4.3.1)
yaml 2.3.8 2023-12-11 [1] CRAN (R 4.3.1)
[1] /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library
──────────────────────────────────────────────────────────────────────────────
I would like to note that using md() for changing cols_label() yields the same behavior, and that it works as expected with gt 0.10.0.
---
title: "dash-test"
format: dashboard
editor: visual
editor_options:
chunk_output_type: console
---
## Heading
```{r}
#| title: a title0
library(gt)
exibble |>
gt::gt() |>
cols_label(
num = md("**here**")
)
```
I tested that the example provided by OP doesn't work in gt 0.11 + Quarto 1.4.554 (have to check for 1.4.555 + 1.5)
I can confirm this is a Quarto issue.
Though @rich-iannone using <span data-qmd instead of <div data-qmd avoid the issue.
Maybe not using div always could be a good idea. Also content is duplicated like this
<div data-qmd="**here**"><div class='gt_from_md'><p><strong>here</strong></p>
</div></div>
and this will create two entry in the table. But maybe this is a Quarto issue, as the content of the div should probably be ignored when processed 🤔
i'll look into it
@jburos Now that Quarto 1.5 is released, it is recommended to update to this version.
Your example renders correctly with Quarto 1.5
- https://github.com/quarto-dev/quarto-cli/issues/9696
- https://github.com/quarto-dev/quarto-cli/issues/9939
Yes I believe we fixed it on Quarto side. @rich-iannone I think this is ok now, also following our last discussion