-
Notifications
You must be signed in to change notification settings - Fork 331
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
Option to disable table striping in computational tables? #6945
Comments
There is an option to disable Quarto processing which also exists directly in |
We indeed apply some bootstrap class by default for computational table quarto-cli/src/format/html/format-html-bootstrap.ts Lines 388 to 396 in 591bae8
It does not see we have a way to opt out this default style... maybe there should be one 🤔 Also @rich it seems a bit disturbing that But maybe this is only about the default bootstrap classes mentioned above 🤷♂️ |
Using ---
format: html
references:
- type: article-journal
id: Lovelace1842
author:
- family: Lovelace
given: Augusta Ada
issued:
date-parts:
- - 1842
title: >-
Sketch of the analytical engine invented by Charles Babbage, by LF Menabrea,
officer of the military engineers, with notes upon the memoir by the translator
title-short: Molecular structure of nucleic acids
container-title: Taylor’s Scientific Memoirs
volume: 3
page: 666-731
language: en-GB
---
```{r}
library(gt)
# This is striped and ignores opt_row_striping but it has the citation
tibble::tribble(
~Thing, ~Citation,
1234, "@Lovelace1842"
) |>
gt() |>
fmt_markdown(columns = Citation) |>
opt_row_striping(row_striping = FALSE)
```
```{r}
# This is not striped but doesn't have the citation
tibble::tribble(
~Thing, ~Citation,
1234, "@Lovelace1842"
) |>
gt() |>
fmt_markdown() |>
tab_options(quarto.disable_processing = TRUE)
``` Actually, any column with |
Well, you asked us to disable processing of the content, and so we did :) That's not really breaking the citation handling; that's you asking us not to do it.
It's not exactly a bug, but I agree we could improve the situation. @rich-iannone, is it possible for gt to emit the regular HTML output that you would in HTML format, as the content of the span, in addition to the markdown you're emitting in the (Irrespective of my comments above, I agree that we should improve user control of gt+quarto tables somehow, either in quarto or gt!) |
Yeah some way to opt out of/control the default bootstrap classes might be helpful, but I don't know the best way to do it. Maybe something like a
It would be parallel-ish to the pandoc-style class settings:
But then that gets into weird interactions with table-making packages like gt and kable/kableExtra that have their own ways of inserting custom css classes 🤷♂️ |
@cscheid I can make that change in gt (it's a very good idea!). |
Good discussion ! We have several topics / ideas now in this :
Just trying to sum up a bit 😅 |
This already exists. Additional classes are forwarded into the classes. The issue is that we currently add 2024 EDIT: the real culprit here is |
This surfaces another relatively major shortcoming of our current YAML schema system, which is that the schemas for code cells are bound to engines, but sometimes we put options there that are only relevant to formats (see the The solution that is in "current quarto style" would be to add a YAML option for projects and document metadata in the In the long run, I think we should consider adding a |
@cscheid I've got a gt PR that makes the proposed change discussed above: rstudio/gt#1455 This requires a corresponding change in Quarto to replace the content of the span with the Quarto-mediated Markdown processing. |
Huh. That's not working right now? |
For reference, discussion on computation table style at |
This issue is still causing mischief. I ran into it with
my table was rendering correctly when I ran the code block in the RStudio IDE but when I rendered to html with Quarto ‘1.4.549’ the stripes were back. The solution from @andrewheiss let me get around the problem. The full table is a lot of code so I don't want to paste it here but I can make a reprex if it would help address the root of the problem. |
Thanks for the feedback. The enhancement discussed is stil to be made, so anything discussed here is still valid.
As a reminder, you can try opting out Quarto HTML table processing. This way, the styling of your gt table will not be touched at all, as the table should be shown as is. However some features could be lost (like markdown cells processing in the HTML table), but if you don't need those, that would be ok |
quarto does funny things with the striping in grouped tables, and you can't turn it off - the striping is automatically added. See GitHub issue: quarto-dev/quarto-cli#6945
Opposite of this, in pdf output, is there a way to enable row striping natively in Quarto in pdf output? So that the pdf output and html output look more similar. I opened #9408 a few weeks ago In quarto-dev/quarto-web@ea95ceb
This is not true for pdf tables, at least in Quarto 1.4... |
Not in Quarto, no. Quarto has relatively little control over PDF styling, and is limited to what GT offers. |
Bug description
In this issue, #922 (comment), there's a difference in how tables are rendered by default: non-computational tables made with Markdown don't have the
.striped
class included, while tables generated with chunks (like withknitr::kable()
or withgt::gt()
do.The rational for including stripes and condensed spacing by default makes sense, since tables full of numbers often need to be more information-dense. Sometimes, though, {kable} and {gt} can be used to create less number-heavy tables and just present text. As of Quarto 1.4.376, the
.striped
class seems hard-baked-in and can't be removed, though (though I might be missing some option to disable it)Steps to reproduce
This example uses {gt} to generate a text-based table. Row striping appears (
<table class="gt_table table table-sm table-striped small" ...>
) regardless of therow_striping
option ingt::opt_row_striping()
(which is a gt thing, not a quarto thing, but quarto's table rendering is inserting its own table class here)Expected behavior
It would be nice to have a table without stripes. In the documentation it shows that it's possible to add a bunch of different bootstrap classes to non-computational tables:
Actual behavior
However, that
.striped
class is hard-coded for computational output and there's no way I can find to disable it, so all kable and gt tables have stripes regardless of controlling stripes with kable- and gt-specific settings.Your environment
Quarto check output
The text was updated successfully, but these errors were encountered: