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
style
function, seetidyverse_style()
for the default argument.style
A 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_examples
Whether or not to style code in roxygen examples.
base_indention
Integer 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_indention
spaces before the code in the case multi-line strings are present. See 'Examples'.
Named arguments passed on to
pkgtools_style_transformer
width
the max width of the code (excludes indent hence approximate)
- transformers
A set of transformer functions. This argument is most conveniently constructed via the
style
argument and...
. See 'Examples'.