-
Notifications
You must be signed in to change notification settings - Fork 432
Expand file tree
/
Copy pathgt-capcross.qmd
More file actions
51 lines (39 loc) · 892 Bytes
/
gt-capcross.qmd
File metadata and controls
51 lines (39 loc) · 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
title: "knitr dark mode - gt"
brand:
light: united-brand.yml
dark: slate-brand.yml
execute:
echo: false
warning: false
---
```{r}
#| echo: false
#| warning: false
library(gt)
gt_brand <- function(brand_yml) {
brand <- yaml::yaml.load_file(brand_yml)
return(function(table) {
table |>
tab_options(
table.background.color = brand$color$background,
table.font.color = brand$color$foreground,
)
})
}
united_theme <- gt_brand("united-brand.yml")
slate_theme <- gt_brand("slate-brand.yml")
```
This example will lose the caption, because combining `tbl-cap` with `renderings` is not supported.
But it should not crash.
::: {#tbl-cap-cross}
```{r}
#| renderings: [light, dark]
#| tbl-cap: a caption
caws <- head(mtcars) %>% gt()
caws |> united_theme()
caws |> slate_theme()
```
:::
Here's a [link](https://example.com).
{{< lipsum 3 >}}