This is adapted from https://github.com/gadenbuie/grkstyle
It differs in that it will break apart long lines regardless of their initial
line breaks to try and fit them into a set width. It does not unbreak lines.
Usage
style_text(text, ..., transformers = pkgtools_style_transformer(...))Arguments
- text
A character vector with text to style.
- ...
Named arguments passed on to
styler::style_text...Arguments passed on to the
stylefunction, seetidyverse_style()for the default argument.styleA function that creates a style guide to use, by default
tidyverse_style. Not used further except to construct the argumenttransformers. Seestyle_guides()for details.include_roxygen_examplesWhether or not to style code in roxygen examples.
base_indentionInteger scalar indicating by how many spaces the whole output text should be indented. Note that this is not the same as splitting by line and add a
base_indentionspaces before the code in the case multi-line strings are present. See 'Examples'.
Named arguments passed on to
pkgtools_style_transformerwidththe max width of the code (excludes indent hence approximate)
- transformers
A set of transformer functions. This argument is most conveniently constructed via the
styleargument and.... See 'Examples'.