Skip to content
Discussion options

You must be logged in to vote

In my opinion, "the right approach" would be for Quarto to handle this natively.

Reusable chunk is another way (probably the easiest) for R code cells.

---
format: gfm
---

<details><summary>Code</summary>

```{r}
#| eval: false
#| label: my-ggplot
1 + 1
```

</details>

```{r}
#| echo: false
#| label: my-ggplot
```

To note and as pointed out, code-fold: true will do the same thing as above but for html-based formats.
Possibly a feature request (#2279) to extend that option to other formats such as gfm.

---
format: 
  html: default
  gfm: default
code-fold: true
---

```{r}
1 + 1
```

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mavam
Comment options

Answer selected by mavam
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants