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

div for interactive html differs between qmd and rmd vignettes #2845

Open
rkb965 opened this issue Jan 28, 2025 · 3 comments
Open

div for interactive html differs between qmd and rmd vignettes #2845

rkb965 opened this issue Jan 28, 2025 · 3 comments
Labels

Comments

@rkb965
Copy link

rkb965 commented Jan 28, 2025

Hi all. Thank you for your patience getting this issue to the correct location. My best guess is that this issue belongs in pkgdown but I am not confident.

General issue: Using gt::opt_interactive() renders appropriately (table displays as expected) in pkgdown::build_site() when my vignette is .Rmd but not when my vignette is .qmd. Both files render appropriately (create interactive tables) when rendered outside of pkgdown, and the other aspects of my quarto vignette render appropriately within pkgdown.

Details: When I have an interactive table in a .qmd, the pkgdown-rendered html contains the table captions, footnotes, etc, but the body of the table is completely missing. When I use the browser's inspector, I see that the gt table in the successfully-rendered htmls (whether rendered from pkgdown of a .Rmd or directly rendered .qmd) has <class="reactable html-widget html-widget-static-bound"> but the unsuccessfully-rendered (file renders but there is no body of the table) table has <class="reactable html-widget">.

I have done this locally on a minimal package. I am using gt 0.11.1, pkgdown 2.1.1, quarto software version 1.6.39, quarto package version 1.4.4, devtools version 2.4.5.9000.

Big thanks for any insights!

I posted this in gt discussions rstudio/gt#1933 but after more digging on my end, I think this does belong as an issue.

Thank you!

---
title: "myvignette"
vignette: >
  %\VignetteIndexEntry{Vignette's Title}
  %\VignetteEngine{quarto::html}
  %\VignetteEncoding{UTF-8}
---

```{r setup}
library(testgtint)
library(gt)
```

```{r}
gt(mtcars) |> 
  opt_interactive()
```
@remlapmot
Copy link

Not sure if this is the solution but it's helpful to know that Quarto does some processing of html tables which you can disable through this option: https://quarto.org/docs/authoring/tables.html#disabling-quarto-table-processing

i.e. you could try

---
title: "myvignette"
vignette: >
  %\VignetteIndexEntry{Vignette's Title}
  %\VignetteEngine{quarto::html}
  %\VignetteEncoding{UTF-8}
---

```{r setup}
library(testgtint)
library(gt)
```

```{r}
#| html-table-processing: none
gt(mtcars) |> 
  opt_interactive()
```

@rkb965
Copy link
Author

rkb965 commented Jan 28, 2025

Thank you for the suggestion. I added the html-table-processing: none and the behavior appears the same: the table is produced appropriately in quarto when rendered outside of pkgdown but is not produced when rendered by pkgdown::build_site().

@jayhesselberth
Copy link
Collaborator

I am guessing that because of the way we build quarto vignettes (rendering a template), some of the required components are missing or aren't being copied over. Hopefully won't be too hard to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants