Code folding for distinct code chunks?

Hello,

I would like to have the option to code_folding: hide within distinct code chunks in an R Markdown file and not in others. There is some code that I want displayed without the ability to hide it, but other code that I want to give the reader an opportunity to look at if they wish. Is there a way to do this? I've searched the webs high and low and am not seeing a straightforward solution, and that may be because there isn't one. But if anyone knows of one, that would be super helpful.

Thanks so much!

Does this not do what you want? Namely:

---
title: "Untitled"
output:
  html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

Some text

<details><summary>Click here</summary>
This is folded

```{r code}
# hidden code
print("Hello world!")
```
</details>

This is outside

```{r}
# not hidden
2^2

```

Gives:
image