Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nested ordered lists in rmarkdown

Tags:

r

r-markdown

I have observed a strange in nested ordered lists while using rmarkdown.

From here, the order of the numbers is ignored in the main list of items. Both of the below set produce the same output.

#set 1:
1.  one
2.  two
3.  three

#set 2:
5.  one
7.  two
1.  three

However, it is not the case in nested list of items.

#set 3:
1.  one
    5.  one
    7.  two
    1.  three
2.  two
3.  three

How to achieve automatic ordering of nested list of items in rmarkdown?

like image 862
Prradep Avatar asked Nov 23 '25 23:11

Prradep


1 Answers

Cf. the next section of the documentation (my emphasis):

Pandoc also pays attention to the type of list marker used, and to the starting number, and both of these are preserved where possible in the output format.

To get the output you want (all new list should begin at 1.), disable the startnum extension (source):

---
output: 
  html_document:
     md_extensions: -startnum
---
like image 78
scoa Avatar answered Nov 26 '25 14:11

scoa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!