我正在尝试使用RMarkdown制作静态网页。我想定义一个UI,它有第一层标签,然后是第一层下面的标签。我已经在RMarkdown: Tabbed and Untabbed headings处查询了类似的问题。但这个答案对我的事业没有帮助。请在下面找到我想要实现的标签结构。
| Results
* Discussion of Results
| Quarterly Results
* This content pertains to Quarterly Results
| By Product
* Quarterly Performance by Products
| By Region
* Quarterly Performance by Region
* Final Words about Quarterly Results
| Yearly Results
* This content pertains to Yearly Results
| By Product
* Yearly Performance by Products
| By Region
* Yearly Performance by Region
* Final Words about Yearly Results
这是我正在使用的.Rmd格式的脚本。但我能够实现的输出看起来像Current Scenario。我希望{Region}选项卡以外的Final Words about Quarterly Results
和Final Words about Yearly Results
分别位于季度结果和年度结果中。
---
output:
html_document:
theme: paper
highlight: tango
number_sections: false
toc: false
toc_float: false
---
# Result Discussion {.tabset}
We will discuss results here
## Quarterly Results {.tabset}
This content pertains to Quarterly Results
### By Product
Quarterly perfomance by Products
### By Region
Quarterly perfomance by Region
Final Words about Quarterly Results
## Yearly Results {.tabset}
This content pertains to Yearly Results
### By Product
Yearly perfomance by Products
### By Region
Yearly perfomance by Region
Final Words about Yearly Results
答案 0 :(得分:1)
问题来自于最后一段(Final Words about Quarterly Results
和Final Words about Yearly Results
)属于最后一级3部分,而不属于父级别2部分。
您必须手动控制渲染的HTML
的切片以获得所需的内容。
使用 pandoc
< 2.0 ,唯一的意思是插入原始HTML
:
---
output:
html_document:
theme: paper
highlight: tango
number_sections: false
toc: false
toc_float: false
---
# Result Discussion {.tabset}
We will discuss results here
## Quarterly Results {.tabset}
This content pertains to Quarterly Results
<div id="quarterly-product" class="section level3">
### By Product
Quarterly perfomance by Products
</div>
<div id="quarterly-region" class="section level3">
### By Region
Quarterly perfomance by Region
</div>
Final Words about Quarterly Results
## Yearly Results {.tabset}
This content pertains to Yearly Results
<div id="yearly-product" class="section level3">
### By Product
Yearly perfomance by Products
</div>
<div id="yearly-region" class="section level3">
### By Region
Yearly perfomance by Region
</div>
Final Words about Yearly Results
如果您使用 pandoc
2.0或更高版本,则可以使用fenced divs
:
---
output:
html_document:
theme: paper
highlight: tango
number_sections: false
toc: false
toc_float: false
---
# Result Discussion {.tabset}
We will discuss results here
## Quarterly Results {.tabset}
This content pertains to Quarterly Results
::: {#quarterly-product .section .level3}
### By Product
Quarterly perfomance by Products
:::
::: {#quarterly-region .section .level3}
### By Region
Quarterly perfomance by Region
:::
Final Words about Quarterly Results
## Yearly Results {.tabset}
This content pertains to Yearly Results
::: {#yearly-product .section .level3}
### By Product
Yearly perfomance by Products
:::
::: {#yearly-region .section .level3}
### By Region
Yearly perfomance by Region
:::
Final Words about Yearly Results
答案 1 :(得分:0)
output:
html_document:
theme: paper
highlight: tango
number_sections: false
toc: false
toc_float: false
---
# Result Discussion {.tabset}
We will discuss results here
## Quarterly Results {.tabset}
This content pertains to Quarterly Results
### By Product
Quarterly perfomance by Products
### By Region
Quarterly perfomance by Region
##
Final Words about Quarterly Results
## Yearly Results {.tabset}
This content pertains to Yearly Results
### By Product
Yearly perfomance by Products
### By Region
Yearly perfomance by Region
##
Final Words about Yearly Results