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

Huxtable Formatting Overridden by Quarto Bootstrapping after Quarto Update to 1.3 #248

Closed
mvanaman opened this issue Oct 9, 2023 · 3 comments

Comments

@mvanaman
Copy link

mvanaman commented Oct 9, 2023

Not sure if this is more of a Quarto or huxtable question.

Sadly, the new Quarto (>= 1.3) undoes some of huxtable formatting in favor of Quarto's bootstrapping table theming. I have tried for html format but not PDF. Here's an example:

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(huxtable)
#> 
#> Attaching package: 'huxtable'
#> The following object is masked from 'package:dplyr':
#> 
#>     add_rownames
iris %>% 
    head() %>% 
    huxtable() %>% 
    theme_article()
#> Warning in knit_print.huxtable(x, ...): Unrecognized output format "gfm-yaml". Using `to_screen` to print huxtables.
#> Set options("huxtable.knitr_output_format") manually to "latex", "html", "rtf", "docx", "pptx", "md" or "screen".
 ─────────────────────────────────────────────────────────────────────
   Sepal.Length   Sepal.Width   Petal.Length   Petal.Width   Species  
 ─────────────────────────────────────────────────────────────────────
            5.1           3.5            1.4           0.2   setosa   
            4.9           3              1.4           0.2   setosa   
            4.7           3.2            1.3           0.2   setosa   
            4.6           3.1            1.5           0.2   setosa   
            5             3.6            1.4           0.2   setosa   
            5.4           3.9            1.7           0.4   setosa   
 ─────────────────────────────────────────────────────────────────────

Column names: Sepal.Length, Sepal.Width, Petal.Length, Petal.Width, Species

Created on 2023-10-09 with reprex v2.0.2

In the resulting html file, striping and probably other stuff I'm not noticing are changed, but so far I just notice striping. The expected output is for the table to resemble the theme_article() styling as shown here i.e., bold headers, no stripes.

This issue was noted in this stackoverflow question, but I found the solution unsatisfactory as it seems to break Quarto's tbl-cap: setting, at least for me.

System details
huxtable Version ‘5.5.2’
R Version 4.3.1 (2023-06-16)
Quarto Version 1.3
RStudio Version 2023.06.1+524 (2023.06.1+524)

EDIT: tbl-caption to tbl-cap

@hughjonesd
Copy link
Owner

I would definitely report to quarto also and reference this bug. Not sure who can fix it best.

@cderv
Copy link

cderv commented Oct 10, 2023

Hi !

I have answered at quarto-dev/quarto-cli#7187 (comment)

This is not a bug per-se but probably some compatibility adjustment with how Quarto works.

  • Quarto uses Bootstrap by default as its style, including for tables.
  • Quarto process HTML table since 1.3, meaning it will parse HTML table, adjust it and write it back. This applies to raw html table too. We preserve style, but some of the bootstrap style like table-striped seems applied despite the inline style you have with huxtable's style
  • Quarto allows opt-ing out this by adding an attributes on <table> - for computation table, for now this is means that each table 📦 needs to allow their user to set this attributes for this to work.

Hope it helps understand.

@hughjonesd
Copy link
Owner

This is now controlled by a new option huxtable.quarto_process, which defaults to FALSE. By default it simply adds the relevant attribute into HTML table tags.

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

No branches or pull requests

3 participants