Is there a way to include the chunk options in the output?
For instance, in this case:
---
title: "Untitled"
format: html
editor: visual
---
```{r}
#| code-fold: true
#| label: example
1 + 1
```
How to get
#| code-fold: true
#| label: example
in the output (on top of them being actually used)?
You can add echo: fenced
to your chunk options. It'll display all the chunk options in your output (except echo: fenced
) as well as the ticks to make the chunk fully reproducible.
You can also add echo: fenced
in your global options.
---
title: "Untitled"
format: html
editor: visual
---
```{r}
#| echo: fenced
#| code-fold: true
#| label: example
1 + 1
```
A second, less recommended option (more prone to errors) would be to add the options twice:
---
title: "Untitled"
format: html
editor: visual
---
```{r}
#| code-fold: true
#| label: example
#| code-fold: true
#| label: example
1 + 1
```