R Markdown:渲染时删除标签集配置 [英] R Markdown: Remove tabset configuration when rendering

查看:54
本文介绍了R Markdown:渲染时删除标签集配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下问题:我正在使用 RMD 和 html_document 创建 HTML 文档.我使用 tabsettabset-pills 来构建内容.我现在的问题是:

I have the following question: I am creating an HTML document using RMD and html_document. I use tabset and tabset-pills to structure the content. My question now is:

我可以渲染相同的 RMD 文档但不解释 tabset 设置吗?

Can I render the same RMD document but do not interprete the tabset settings?

举个例子:我可以渲染这个 RMD 文件导致下面两个不同的输出吗?

To provide an example: Can I render this RMD file resulting in the two different outputs below?

---
output: html_document
---

# Headline 1

## Headline 2 {.tabset}

### Headline 3 in a tab

### Headline 4 in a tab

### Headline 5 in a tab

谢谢斯蒂芬

推荐答案

您可以使用参数化文档和内联代码:

You can use a parameterized document and inline code:

---
title: Hello
output: html_document
params:
  intab: TRUE
---

# Headline 1

## Headline 2 `r if (isTRUE(params$intab)) "{.tabset}"`

### Headline 3 in a tab

### Headline 4 in a tab

### Headline 5 in a tab

Rscript.exe -e "rmarkdown::render('62095186.Rmd')"                            # default
# Rscript.exe -e "rmarkdown::render('62095186.Rmd', params=list(intab=TRUE))" # same
Rscript.exe -e "rmarkdown::render('62095186.Rmd', params=list(intab=FALSE))"  # by exception

这篇关于R Markdown:渲染时删除标签集配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆