Skip to content

You can use this function to format a line of cli text, without emitting it to the screen. It uses cli_text() internally.

Usage

format_inline(
  ...,
  .envir = parent.frame(),
  collapse = TRUE,
  keep_whitespace = TRUE
)

Arguments

...

Passed to cli_text().

.envir

Environment to evaluate the expressions in.

collapse

Whether to collapse the result if it has multiple lines, e.g. because of \f characters.

keep_whitespace

Whether to keep all whitepace (spaces, newlines and form feeds) as is in the input.

Value

Character scalar, the formatted string.

Details

format_inline() performs no width-wrapping.

Examples

format_inline("A message for {.emph later}, thanks {.fn format_inline}.")
#> [1] "A message for \033[3mlater\033[23m, thanks `format_inline()`."