md_verb: Convert to verbatim Markdown

md_verbR Documentation

Convert to verbatim Markdown

Description

Converts the provided R expressions to their character representation using base::deparse1() and formats them as verbatim Markdown.

Usage

md_verb(
  ...,
  .eval = TRUE,
  .collapse = " ",
  .backtick = TRUE,
  .control = c("keepNA", "keepInteger", "niceNames", "showAttributes", "warnIncomplete"),
  .width.cutoff = 500L,
  .nlines = -1L
)

Arguments

...

R expression(s) to convert to verbatim Markdown. Must be unnamed. Dynamic dots are supported.

.eval

Whether or not to evaluate the expression(s) in ....

.collapse

String to separate the results of a single expression in ....

.backtick

Whether or not to enclose symbolic names in backticks if they do not follow the standard syntax.

.control

Deparsing options. A character vector or NULL. See base::.deparseOpts for all possible options.

.width.cutoff

Cutoff (in bytes) at which line-breaking is tried. An integer scalar between 20 and 500.

.nlines

Maximum number of lines to produce. A negative value indicates no limit. An integer scalar.

Value

A character vector of the same length as ....

See Also

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

Examples

pal::md_verb(1:3, "It", is.logical, `||`, FALSE, quote(`?!`)) |>
  pal::cat_lines()

# you can splice vector or list expressions if you like
pal::md_verb(!!!1:3, "It", is.logical, `||`, FALSE, quote(`?!`)) |>
  pal::cat_lines()

# to evaluate, or not to evaluate, that is the question
pal::md_verb(!!!1:3, "It", is.logical, `||`, FALSE, quote(`?!`),
             .eval = FALSE) |>
  pal::cat_lines()

# unevaluated expressions do not need to exist
pal::md_verb(Not, actual(), `R-expressions`,
             .eval = FALSE) |>
  pal::cat_lines()

# you can opt out of wrapping non-standard syntax in additional backticks
pal::md_verb(Not, actual(), `R-expressions`,
             .eval = FALSE,
             .backtick = FALSE) |>
  pal::cat_lines()

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