-
-
Notifications
You must be signed in to change notification settings - Fork 979
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
Headerless tables not formatted correctly #1893
Comments
Yeah, my bad, I had not looked enough at the resulting HTML, which, in principle is fine indeed. What I am expecting when converting the following document...
...is this... ...instead of this... The difference between them is the class |
Thank you for the precision! I agree it looks better ! From my test and example with the command line, it seems pandoc itselfs does not output your expected table. |
rmarkdown/inst/rmd/h/default.html Line 562 in c3b37f2
|
Yeah, I believe it's not an issue with Pandoc, but with rmarkdown's HTML template.
So yeah, Pandoc does not output my expected table, but Pandoc does neither for tables with headers. The styling is added by rmarkdown, but only for tables with headers.
Pandoc doesn't provide formatting (as in: CSS) at all by default. |
@fkohrt You could add the classes by yourself via a ---
title: "Beheaded tables"
output: html_document
---
Right Left Center Default
------- ------ ---------- -------
12 12 12 12
123 123 123 123
1 1 1 1
Table: Simple table with header
------- ------ ---------- -------
12 12 12 12
123 123 123 123
1 1 1 1
------- ------ ---------- -------
Table: Simple table without header
```{js, echo=FALSE}
$('table').addClass('table table-condensed');
``` We may be able to do this in the default HTML template, but I'm not sure if it could break anything, given that the template has existed for quite a few years. |
I just opened a PR with a quick fix to discuss if it worth taking the risk that something break or not. |
I saw people struggle with this before, so I'm not sure of no action is the best bet in the long run. But you could wait until the dust settles with the AST change to tables, i.e. the readers and writers get implemented. The immediate problem I had is remedied by the two workarounds discussed above. |
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary. |
Pandoc's simple tables may or may not contain a header1. Headerless tables are, however, not formatted correctly by rmarkdown. The following document...
...renders to:
I ran into this while attempting to write a table with a header column – for which a syntax is underway, but not available right now – and hence without a header row. My attempt to overcome rmarkdown's limitation is as follows (based on this solution by Jan):
...which looks like this:
But I believe there's no reason to limit R Markdown to ... capitated tables.
xfun::session_info('rmarkdown')
1 as can multiline tables and grid tables, but not pipe tables
By filing an issue to this repo, I promise that
xfun::session_info('rmarkdown')
. I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version:remotes::install_github('rstudio/rmarkdown')
.I understand that my issue may be closed if I don't fulfill my promises.
The text was updated successfully, but these errors were encountered: