as_md_list: Convert a character vector to a Markdown list

as_md_listR Documentation

Convert a character vector to a Markdown list

Description

Convenience wrapper around pander::pandoc.list.return() to convert a character vector (or something coercible to) to a Markdown list.

Usage

as_md_list(
  x,
  type = c("unordered", "ordered", "ordered_roman"),
  tight = TRUE,
  indent_lvl = 0L,
  wrap = NULL
)

Arguments

x

R object, e.g. a character vector. Each element of x will become an item in the resulting Markdown list.

type

Markdown list type. One of

  • "unordered" for an unordered aka bullet list. Corresponds to ⁠<ul>⁠ in HTML.

  • "ordered" for an ordered aka numbered list. Corresponds to ⁠<ol>⁠ in HTML.

  • "ordered_roman" for a variation of an ordered/numbered list with uppercase roman numerals instead of Arabic numerals as list markers.

tight

Whether or not to add additional spacing between list items.

indent_lvl

Level of indentation of the resulting Markdown list. For each level, four additional spaces are added in front of every list item. An integer scalar.

wrap

An optional string to wrap the list items in.

Value

If x is empty, a character vector of length zero. Otherwise, a character scalar.

See Also

Other (Pandoc) Markdown functions: as_md_val_list(), as_md_vals(), md_verb(), pipe_table(), strip_md(), strip_md_footnotes()

Examples

rownames(mtcars) |>
  pal::as_md_list() |>
  cat()

salim-b/pal documentation built on Feb. 28, 2025, 6:51 p.m.