Reputation: 1800
I am generating an HTML report using Rmarkdown in which I want the user to have an option of looking at code (when they want by using a toggle show/hide code) before each section or figure.
I am wondering if there is an option to do so globally and individually for each code chunk.
I have looked at some previous solutions using javascript, but I am not familiar with the language. I was hoping there is an option I can choose within Rmarkdown.
Previous approaches using javascript are shown here and here, but I am not sure how to include these in my Rmarkdown file. I have tried the following, but it didn't work
<script src="toggleR.js"></script>
```{r}
summary(cars)
```
A working example in Rmarkdown would be extremely helpful!!
Thanks
Upvotes: 4
Views: 9778
Reputation: 1800
From the answer to a similar question by Yihue -this functionality has now been added as code folding. See more at http://rmarkdown.rstudio.com/html_document_format.html
Upvotes: 4