Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[quarto] tables with fmt_markdown don't render in quarto dashboard #1605

Open
6 tasks done
jburos opened this issue Mar 11, 2024 · 2 comments
Open
6 tasks done

[quarto] tables with fmt_markdown don't render in quarto dashboard #1605

jburos opened this issue Mar 11, 2024 · 2 comments

Comments

@jburos
Copy link

jburos commented Mar 11, 2024

Prework

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

  • 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.
---
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()
```
Screenshot 2024-03-11 at 3 52 25 PM

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

──────────────────────────────────────────────────────────────────────────────
@olivroy
Copy link
Contributor

olivroy commented May 13, 2024

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**")
  )
```

@cderv
Copy link
Collaborator

cderv commented May 17, 2024

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

@rich-iannone rich-iannone changed the title tables with fmt_markdown don't render in quarto dashboard [quarto] tables with fmt_markdown don't render in quarto dashboard May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants