Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R Markdown Bullet List with Multiple Levels

https://github.com/rstudio/cheatsheets/raw/master/rmarkdown-2.0.pdf

The cheat sheet above lists the following syntax to generate a bulleted list in R Markdown. * is the primary solid bullet. + is a secondary hollow bullet. And - is a tertiary solid square.

* unordered list + sub-item 1 + sub-item 2 - sub-sub-item 1

After I render the output with knitr I don't get the expected output. I get what's shown below. The second and third lines are not indented. Only the very last line is indented, and only one indent instead of the expected two. And all bullets are the secondary hollow style. It's as if I put the following syntax into R Studio, but I didn't.

+ unordered list + sub-item 1 + sub-item 2 + sub-sub-item 1

How do I get what I intended, the first chunk of pasted syntax?

like image 496
stackinator Avatar asked Mar 03 '18 13:03

stackinator


People also ask

What is the difference between markdown and RMarkdown?

R Markdown (markup language)R Markdown files are plain text files that typically have the file extension . Rmd . They are written using an extension of markdown syntax that enables R code to be embedded in them in a way which can later be executed.

What is Knitr in RMarkdown?

RMarkdown is an extension to markdown which includes the ability to embed code chunks and several other extensions useful for writing technical reports. The rmarkdown package extends the knitr package to, in one step, allow conversion between an RMarkdown file (.Rmd) into PDF, HTML, word document, amongst others.


2 Answers

For each sub-level instead of one tab, include two:

* unordered list
    + sub-item 1 
    + sub-item 2 
        - sub-sub-item 1

Output:

enter image description here

like image 79
Marina Avatar answered Oct 22 '22 09:10

Marina


See the Pandoc documentation under Block content in list items.

like image 38
Benjamin Christoffersen Avatar answered Oct 22 '22 08:10

Benjamin Christoffersen