缩进而不在RMarkdown中添加项目符号或数字

时间:2017-11-03 02:25:56

标签: r html-lists markdown knitr r-markdown

我想制作一个缩进列表,但我不希望它有子弹点或数字。我在RStudio中使用Rmarkdown,并编织为html。

#### bla bla bla  

* Example indented line with bullet point  
    * Another indent with another bullet point  
* Yea this is good except for the stupid bullets!  

1. Example indented line with numbers  
    * sure and an indent with a bullet too  
2. But there's these stupid numbers now!  

  two spaces doesn't indent at all  
    or nest indent with 4  
  yea still no indent with 2.  

    four spaces ALSO doesn't indent  
      just makes some stupid code
    why do you hate indents rmd??

2 个答案:

答案 0 :(得分:5)

如果要更改列表的外观并输出到HTML,请使用css:

---
title: "ListTest"
output: html_document
---

<style>
.nobullet li {
  list-style-type: none;
}
</style>

<div class="nobullet">
* This list
* Doesn't have bullets
</div>

* This list 
* Is normal

这不适用于其他输出格式。

答案 1 :(得分:4)

这可以使用{Markdown}语法内置的Line Blocks来实现。如果您希望缩进得到尊重,可以以|开始。

这种方法适用于多种输出格式,不需要任何其他CSS样式:

---
output:
  html_document: default
  pdf_document: default
---

Here is some text with no indentation

|    A list
|         A sublist
|         Sublist Item 2
|         Sublist Item 3