I want to create some functions for my team that standardize Quarto code chunk options. Is this possible? I want to control not just label
, echo
, and eval
, but I want to include some other options like setting the classes
argument based on the input content.
```{r}
cat("#| eval: false")
cat("#| classes: my-class")
mtcars
```
I basically want to find a way to get this function to work.
my_quarto_chunk <- function(eval = T, echo = F, classes = NULL, ...){
# Set chunk options
cat("```{r}")
cat("#| eval:", eval)
cat("#| echo:", echo)
cat("#| classes:", classes)
# Code to execute / display in this code chunk
...
cat("```")
}
2