-
Notifications
You must be signed in to change notification settings - Fork 284
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
Markdown tables use different style than code (kable) tables #922
Comments
It's on our short list to make this configurable, but right now tables from data frames are striped (and more compact) and tables within content are not. |
To note, this can easily be solved: ---
title: "Table vs. kable"
engine: knitr
---
A Markdown table is *not* striped:
| a| b| c|
|--:|--:|--:|
| 1| 6| 11|
| 2| 7| 12|
| 3| 8| 13|
| 4| 9| 14|
| 5| 10| 15|
But a table generated with `knitr::kable()` is striped (besides other minor differences):
```{r}
#| output: asis
data.frame(a=1:5, b=6:10, c=11:15) |> knitr::kable()
```
Also, Quarto table processing can be disable, see https://quarto.org/docs/authoring/tables.html#disabling-quarto-table-processing. |
I am surprised by this trick of using Striped tabled is indeed a default we set for computational table quarto-cli/src/format/html/format-html-bootstrap.ts Lines 390 to 398 in ecf2a08
which is different than our default for non computational table.
@jjallaire what is the reason to make the two style different ? (0a352d6 and 4230513)
With new feature in 1.3 (https://quarto.org/docs/prerelease/1.3/tables.html), one can now apply striped to Markdown table easily (BTW @jjallaire is this the configurable you were mentioning ? or do we plan for more ?) This example would be the other counterpart to make the Markdown table use the same style as the computational table ---
title: "Table vs. kable"
engine: knitr
---
A Markdown table can be striped:
| a| b| c|
|--:|--:|--:|
| 1| 6| 11|
| 2| 7| 12|
| 3| 8| 13|
| 4| 9| 14|
| 5| 10| 15|
: {.striped .sm .small}
But a table generated with `knitr::kable()` is striped (besides other minor differences):
```{r}
data.frame(a=1:5, b=6:10, c=11:15) |> knitr::kable()
```
@mcanouil Not sure kable processing happens here for knitr output. Are you suggesting to apply that for the Markdown table ? |
Indeed it does not in this case, Quarto processing would mostly matters when using |
The reason they are different is that data looks dramatically better w/ condensed/striped presentation, whereas content often looks worse (they are really two different use cases of table). The solution should be allowing uses to override the default (which I believe we were slated to do in v1.3, not sure if we exposed every required knob). |
Oh I see. Did not think of that. Thanks for the precision. |
Since it is by design, do we keep this open? |
We should close it (and then make sure there is a way for users to override the default behavior that is clearly documented) |
Let's close this and follow work for opting out in #6945 |
Consider the following reprex (tested with quarto 0.9.424):
Although the output of the code cell is exactly equal to the Markdown table in the example (the first table), the output look different, most notably only the
kable
is striped:I would have expected that the tables use the same style by default. If this is not desired, is there a way I can make them the same?
The text was updated successfully, but these errors were encountered: