style_text: Style a string

Description Usage Arguments See Also Examples

View source: R/ui.R

Description

Styles a character vector. Each element of the character vector corresponds to one line of code.

Usage

1
2
style_text(text, ..., style = tidyverse_style,
  transformers = style(...), include_roxygen_examples = TRUE)

Arguments

text

A character vector with text to style.

...

Arguments passed on to the style function.

style

A function that creates a style guide to use, by default tidyverse_style() (without the parentheses). Not used further except to construct the argument transformers. See style_guides() for details.

transformers

A set of transformer functions. This argument is most conveniently constructed via the style argument and .... See 'Examples'.

include_roxygen_examples

Whether or not to style code in roxygen examples.

See Also

Other stylers: style_dir, style_file, style_pkg, styler_addins

Examples

1
2
3
4
5
6
7
8
style_text("call( 1)")
style_text("1    + 1", strict = FALSE)
style_text("a%>%b", scope = "spaces")
style_text("a%>%b; a", scope = "line_breaks")
style_text("a%>%b; a", scope = "tokens")
# the following is identical but the former is more convenient:
style_text("a<-3++1", style = tidyverse_style, strict = TRUE)
style_text("a<-3++1", transformers = tidyverse_style(strict = TRUE))

styler documentation built on Oct. 30, 2019, 10:30 a.m.