Creates a Pandoc's markdown format list from provided character vector/list.
pandoc.list.return(
elements,
style = c("bullet", "ordered", "roman"),
loose = FALSE,
add.line.breaks = TRUE,
add.end.of.list = TRUE,
indent.level = 0,
missing = panderOptions("missing"),
...
)character vector of strings
the required style of the list
adding a newline between elements
adding a leading and trailing newline before/after the list
adding a separator comment after the list
the level of indent
string to replace missing values
extra arguments passed by from parent call, disregarded
By default this function outputs (see: cat) the result. If you would want to catch the result instead, then call the function ending in .return.
John MacFarlane (2012): _Pandoc User's Guide_. https://johnmacfarlane.net/pandoc/README.html
## basic lists
pandoc.list(letters[1:5])
#>
#> * a
#> * b
#> * c
#> * d
#> * e
#>
#> <!-- end of list -->
#>
pandoc.list(letters[1:5])
#>
#> * a
#> * b
#> * c
#> * d
#> * e
#>
#> <!-- end of list -->
#>
pandoc.list(letters[1:5], 'ordered')
#>
#> 1. a
#> 2. b
#> 3. c
#> 4. d
#> 5. e
#>
#> <!-- end of list -->
#>
pandoc.list(letters[1:5], 'roman')
#>
#> I. a
#> II. b
#> III. c
#> IV. d
#> V. e
#>
#> <!-- end of list -->
#>
pandoc.list(letters[1:5], loose = TRUE)
#>
#> * a
#>
#> * b
#>
#> * c
#>
#> * d
#>
#> * e
#> <!-- end of list -->
#>
## nested lists
l <- list("First list element",
rep.int('sub element', 5),
"Second element",
list('F', 'B', 'I', c('phone', 'pad', 'talics')))
pandoc.list(l)
#>
#> * First list element
#> * sub element
#> * sub element
#> * sub element
#> * sub element
#> * sub element
#> * Second element
#> * F
#> * B
#> * I
#> * phone
#> * pad
#> * talics
#>
#> <!-- end of list -->
#>
pandoc.list(l, loose = TRUE)
#>
#> * First list element
#>
#> * sub element
#>
#> * sub element
#>
#> * sub element
#>
#> * sub element
#>
#> * sub element
#>
#>
#> * Second element
#>
#> * F
#>
#> * B
#>
#> * I
#>
#> * phone
#>
#> * pad
#>
#> * talics
#>
#>
#> <!-- end of list -->
#>
pandoc.list(l, 'roman')
#>
#> I. First list element
#> I. sub element
#> II. sub element
#> III. sub element
#> IV. sub element
#> V. sub element
#> II. Second element
#> I. F
#> II. B
#> III. I
#> I. phone
#> II. pad
#> III. talics
#>
#> <!-- end of list -->
#>
## complex nested lists
pandoc.list(list('one', as.list(2)))
#>
#> * one
#> * 2
#>
#> <!-- end of list -->
#>
pandoc.list(list('one', list('two')))
#>
#> * one
#> * two
#>
#> <!-- end of list -->
#>
pandoc.list(list('one', list(2:3)))
#>
#> * one
#> * 2
#> * 3
#>
#> <!-- end of list -->
#>