admin管理员组文章数量:1390437
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
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
Share Improve this question edited May 23, 2017 at 12:08 CommunityBot 11 silver badge asked Aug 18, 2015 at 15:36 SatyaSatya 1,8001 gold badge16 silver badges40 bronze badges 2- The accepted answer for your second link should give you what you want. For output chunks take a look at this: stackoverflow./questions/37755037/… – Martin Schmelzer Commented Jun 16, 2016 at 7:41
- Possible duplicate of How to hide code in RMarkdown, with option to see it – Martin Schmelzer Commented Jun 16, 2016 at 14:12
1 Answer
Reset to default 4From the answer to a similar question by Yihue -this functionality has now been added as code folding. See more at http://rmarkdown.rstudio./html_document_format.html
本文标签: javascripttoggle showhide code in RMarkdownStack Overflow
版权声明:本文标题:javascript - toggle showhide code in RMarkdown - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744618602a2615883.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论