2

We have code folding in RMarkdown documents, but only when the output is html_document. The answer: https://stackoverflow.com/a/37839683/5359328 doesn't work in Distill for R Markdown Articles since the way of adding CSS and JS is unknown. How to use code folding in Distill for R Markdown Articles?

Siddharth Venu
  • 1,318
  • 13
  • 26

1 Answers1

0

You can use the codefolder package for either Distill documents or Bookdown.

For Distill this is done by including the following in the Rmarkdown document:

<aside>
```{r codefolder, echo=FALSE, results='asis'}
codefolder::distill(init = "hide")
```
</aside>