【问题标题】:adding horizontal rule to html rmarkdown doc hides sections of text向 html rmarkdown doc 添加水平规则隐藏文本部分
【发布时间】:2021-01-03 22:17:11
【问题描述】:

我正在制作一个结合到 HTML 页面的 Rmarkdown 文档。我不想用标题或项目符号分隔一些文本部分,我只想在它们之间画水平线。

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

---
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

请注意,文本部分 text1 text2text3 在您编织到 html 时不会全部显示。当我弄乱它时,我最终会发现不同的缺失或缺失,但我无法让它们全部出现或找出原因。

【问题讨论】:

  • 尝试在每条横线之后添加另一个类似中断。
  • 啊哈!这工作@Spingolini,谢谢!

标签: html formatting knitr r-markdown


【解决方案1】:

水平分隔符需要被一个前导和后继的新行包围,像这样:

## heading
much interesting text ...

---

## heading
more interesting text

【讨论】:

  • 如何自定义横断?在模板上?
猜你喜欢
  • 1970-01-01
  • 2012-03-30
  • 1970-01-01
  • 2014-11-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-07-28
  • 2021-10-19
相关资源
最近更新 更多