我正在尝试使用RMarkdown创建静态网页.我想定义一个用户界面,该用户界面具有第一层选项卡,然后在第一层下方具有选项卡.我已经在 RMarkdown:Tabbed和Untabbed标题中研究了类似的问题.但是那个答案对我的事业没有帮助.请在我想要实现的标签结构下方找到.
I am trying to make a static webpage using RMarkdown. I want to define a UI which has a first layer of tabs and then tabs underneath the first layer. I've already looked into a similar question at RMarkdown: Tabbed and Untabbed headings . But that answer doesn't help my cause. Please find below the tab structure that I want to acheive.
| 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格式的脚本.但是我能够实现的输出看起来像这样当前场景.我希望在区域"选项卡的外部以及在季度结果"和年度结果"中分别添加Final Words about Quarterly Results和Final Words about Yearly Results.
Here is the script in .Rmd format that I was using. But the output I was able to achieve look likes this Current Scenario. I'd want to have Final Words about Quarterly Results and Final Words about Yearly Results outside the Region tab and in Quarterly Results and Yearly Results respectively.
--- 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推荐答案
问题来自以下事实:最后一个段落(Final Words about Quarterly Results和Final Words about Yearly Results)属于最后一个级别3部分,而不属于父级别2部分. 您必须手动控制渲染的HTML的切片以获得所需的内容.
The problem comes from the fact that the last paragraphs (Final Words about Quarterly Results and Final Words about Yearly Results) belong to the last level 3 section and not to the parent level 2 section. You have to manually control the sectioning of the rendered HTML to obtain what you want.
使用 pandoc< 2.0 ,唯一的办法是插入原始的HTML:
Using pandoc < 2.0, the only mean is to insert raw 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或更高版本,则可以使用被隔离的divs :
If you use pandoc 2.0 or greater, you can use 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更多推荐
RMarkdown似乎无法在选项卡中生成选项卡
发布评论