将水平线添加到html rmarkdown doc隐藏文本的某些部分 [英] adding horizontal rule to html rmarkdown doc hides sections of text

查看:315
本文介绍了将水平线添加到html rmarkdown doc隐藏文本的某些部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作编织到HTML页面的Rmarkdown文档.我只想在它们之间绘制水平线,而不是用标题或项目符号来分隔一些文本部分.

I am making an Rmarkdown document that knits to an HTML page. Instead of separating some text sections with headers or bullets, I just want to draw horizontal lines between them.

根据 http://rmarkdown.rstudio.com/authoring_basics.html 称为水平规则",我可以使用三个或更多---来做到这一点.但是,当我实际尝试执行此操作时,html文档中的各个部分消失了.这是我的代码的一个非常简单的示例:

According to http://rmarkdown.rstudio.com/authoring_basics.html this would be called a "horizontal rule" and I can do that with three or more ---. However when I actually try to do this, various sections disappear from the html doc. Here is a very simple example of my code:

---
title: "formatting issue"
author: "rrr"
output: 
  html_document:
    toc: true
    toc_depth: 2
    toc_float: true
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

# bla {.tabset}  

## tab 1  

---  
**text1**  
bla  

---
**text2**  
bla

---
**text3**  
bla  

---  

## tab 2  

bla

## tab 3  

bla

# bla  

bla bla bla bla

请注意,当您编织成html时,文本部分 text1 text2 text3 不会全部显示.当我弄乱它时,我只会发现是否缺少其他不同的东西,但是我无法让它们全部出现或弄清楚原因.

Notice that text sections text1 text2 and text3 do not all show up when you knit to html. When I mess around with it, I just end up with different ones missing or not, but I can't get them all to show up or figure out why.

推荐答案

水平分隔符需要用换行符开头和结尾,如下所示:

The horizontal break needs to be surrounded by a beginning and an ending new line, like this:

## heading
much interesting text ...

---

## heading
more interesting text

这篇关于将水平线添加到html rmarkdown doc隐藏文本的某些部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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