Reputation: 33
I'm using RMarkdown's code-folding to hide code in an HTML document with this in the YAML header:
---
output:
html_document:
code_folding: hide
---
But in the rendered document it's impossible to know what each chunk is doing without unfolding it, or putting a text description before/after it.
Is there a way to change the appearance of a folded chunk so it displays the chunk label (or a short description) of each chunk next to the "Show" button, preferably in a way that distinguishes it from regular markdown text? Ideally I'm hoping to have a chunk like this:
#| fold-label: "Import and cleanup data"
#| warning: FALSE
library(tidyverse)
mydata <- mtcars %>%
mutate(cleaned = T)
Look like this when folded (but keeping the Show button):
# Import and cleanup data
Upvotes: 0
Views: 50
Reputation: 17389
If you have an option to switch from RMarkdown to Quarto, you could use code-summary
.
---
format:
html:
code-fold: true
---
```{r}
#| code-summary: "Import and cleanup data"
mtcars
```
Upvotes: 1