Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/resources/filters/quarto-post/cell-renderings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function choose_cell_renderings()
return {
Div = function(div)
-- Only process cell div with renderings attr
if not div.classes:includes("cell") or not div.attributes["renderings"] then
if not div.classes or not div.classes:includes("cell") or not div.attributes["renderings"] then
return nil
end
local renderingsJson = div.attributes['renderings']
Expand All @@ -24,7 +24,7 @@ function choose_cell_renderings()
local cods = {}
local firstCODIndex = nil
for i, cellOutput in ipairs(div.content) do
if cellOutput.classes:includes("cell-output-display") then
if cellOutput.classes and cellOutput.classes:includes("cell-output-display") then
if not firstCODIndex then
firstCODIndex = i
end
Expand Down
51 changes: 51 additions & 0 deletions tests/docs/smoke-all/dark-mode/gt-capcross.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,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 >}}
Loading