I would like to use a code-fold option in a revealjs Quarto presentation, or something similar. When we use this option in a code chunk like this:
---
title: "Code-fold in revealjs"
format: revealjs
code-fold: true
---
## Graph
```{r}
#| code-fold: true
#| code-summary: "expand for full code"
library(ggplot2)
dat <- data.frame(cond = rep(c("A", "B"), each=10),
xvar = 1:20 + rnorm(20,sd=3),
yvar = 1:20 + rnorm(20,sd=3))
ggplot(dat, aes(x=xvar, y=yvar)) +
geom_point(shape=1) +
geom_smooth()
```
Output:
We can see there is no code-fold button. So I was wondering if anyone knows if there is an option like that in revealjs?

Update
Just use
echo: true, No need to use that Lua filter.Quarto
revealjsformat by default usesecho: falsefor every chunk. That's code-folding will not work by default (because there is no code block to fold in the rendered slide).You can use the following Lua filter to add code folding
code-fold.lua