我可以在rmarkDown html_document中删除[代码]按钮,同时仍使用[显示/隐藏所有代码]按钮显示代码
虽然我喜欢显示/隐藏code_folding
html_document
在rmarkDown中输出的属性允许的所有代码,但我不喜欢看到a <<<代码>代码到处都有一些代码,因为它在文档中创建了“空行”。
有没有一种方法可以使用属性或一些JavaScript魔术删除此/这些 button(s),
- 无需更改RMD文档(即。
- 而 通过
显示/隐藏所有代码,显示/隐藏所有代码
切换
以下是一个示例:
---
title: "Test"
date: '`r Sys.Date()`'
output:
html_document:
code_download: true
code_folding: 'hide'
---
# Title 1
chunk 1
```{r, eval = FALSE}
1+1
```
```{r, eval = FALSE}
1+2
```
```{r}
1+3
```
呈现这样的渲染:
While I like the possibility to show/hide all code that is allowed by the code_folding
property of the html_document
output in rmarkdown, I do not like that I have to see a Code
button everywhere there is some code because it creates "empty line(s)" in the document.
Is there a way to remove this/these Code
button(s) with a property or some javascript magic
- without altering the Rmd document (ie. not writing some additional code in the document itself)
- while still allowing to show/hide all code through the
Show/Hide All Code
toggle
Here is an example:
---
title: "Test"
date: '`r Sys.Date()`'
output:
html_document:
code_download: true
code_folding: 'hide'
---
# Title 1
chunk 1
```{r, eval = FALSE}
1+1
```
```{r, eval = FALSE}
1+2
```
```{r}
1+3
```
Which renders like this:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用CSS规则隐藏代码折叠按钮。
style.css
You can hide the code-folding buttons with a css rule.
The style.css