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

row striping options not respected in HTML rendered from Quarto due to table-striped CSS tag #1812

Closed
drleehw opened this issue Jul 26, 2024 · 2 comments

Comments

@drleehw
Copy link

drleehw commented Jul 26, 2024

gt doesn't seem to respect the row_striping options when rendering through Quarto to HTML.

For example:
`data <- data.frame(
Name = c("John", "Jane", "Doe"),
Age = c(28, 34, 45),
Occupation = c("Engineer", "Doctor", "Artist")
)

Render the table using gt

gt_table <- gt(data)

gt_table %>% opt_stylize(style = 1, color = "blue", add_row_striping = FALSE)`

Or more directly:
gt_table %>% opt_row_striping(row_striping = FALSE)

Both produce tables in HTML that still have row striping. This seems to be because a table-striped is being applied regardless and the Quarto Bootswatch css applies formatting to all objects with that tag. Manually removing that tag from the resultant HTML file fixes the issue, but modifying the properties applied to that tag with CSS is complex and beyond the CSS knowledge of many R users.

Untitled
@olivroy
Copy link
Collaborator

olivroy commented Jul 26, 2024

The way to go is with https://quarto.org/docs/authoring/tables.html#disabling-quarto-table-processing (chunk or global option) like we do in some gt documentation.

---
title: "gt visual tests"
format: html
editor: source
description: >
Visual tests between grid, interactive, LaTeX, and html output.
code-link: true
toc: true
html-table-processing: none
code-fold: true
---

or with tab_options(quarto.disable_processing = T) . In Quarto 1.5, they added a new class

Further discussion in quarto-dev/quarto-cli#6945 or #1739

In Quarto 1.5, this does the trick as well.

```{r}
#| classes: plain
gt(exibble)
```

@drleehw
Copy link
Author

drleehw commented Jul 26, 2024

Superb! Thanks for the quick help, @olivroy. Can confirm it works.

@drleehw drleehw closed this as completed Jul 26, 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

3 participants