rstudio / gt

Easily generate information-rich, publication-quality tables from R
https://gt.rstudio.com
Other
1.99k stars 200 forks source link

Have gt tables look okay in bookdown, blogdown, xaringan #492

Open rich-iannone opened 4 years ago

rich-iannone commented 4 years ago

In bookdown, blogdown, pkgdown, and xaringan (and others) there are CSS rules that directly affect elements such as <table>, <th>, <tr>, etc., leading to unexpected results when integrating a gt table in any documents/pages.

The solution is to implement a simple CSS reset at the table level. Once that's done, perform integration tests on all of these.

brshallo commented 3 years ago

{gt} seems to substantially increase the .ReadingTime variable as calculated by hugo.

I went through and changed a post from using knitr::kable() to using gt::gt() on several tables in a post and found my article's read time had substantially increased as a result. My guess is this has to do with the way gt adds css to the page... but unsure.

The specific article where I noticed this can be found here. (Wasn't sure was worth opening a new issue etc. as seems related to other things...)

Side note:

I turned off displaying .ReadingTime on longer posts via:

    {{ if and (eq .Section "post") (lt .ReadingTime 17)}} 
    <span class="article-duration">{{ .ReadingTime }} min read</span>
    {{ end }}

In single.html.

jthomasmock commented 2 years ago

Just wanted to drop in and add Quarto to the list of above formats 😉