Skip to contents

Styling API

Functions for styling code

style_text()
Style a string
style_file()
Style files with R source code
style_pkg()
Prettify R source code
style_dir()
Prettify arbitrary R code
styler_addins
Stylers for RStudio Addins
styler_options
Package options

Fine-tune styling

Customize style guides

tidyverse_style()
The tidyverse style
specify_reindention() tidyverse_reindention()
Specify what is re-indented how
specify_math_token_spacing() tidyverse_math_token_spacing()
Specify spacing around math tokens
create_style_guide()
Create a style guide
specify_transformers_drop()
Specify which tokens must be absent for a transformer to be dropped

Non-functional documentation

Explaining features

caching
Remember the past to be quicker in the future
stylerignore
Turn off styling for parts of the code
styler styler-package
styler: Non-Invasive Pretty Printing of R Code

Caching

Utilities to help manage the styler cache

cache_activate() cache_deactivate()
Activate or deactivate the styler cache
cache_clear()
Clear the cache
cache_info()
Show information about the styler cache

Third-party style guide helpers

Utilities for customizing styler for non-tidyverse style guides

compute_parse_data_nested()
Obtain a nested parse table from a character vector
next_non_comment() previous_non_comment()
Find the index of the next or previous non-comment in a parse table.
is_curly_expr() is_for_expr() is_conditional_expr() is_while_expr() is_function_call() is_function_declaration() is_comment() is_tilde_expr() is_asymmetric_tilde_expr() is_symmetric_tilde_expr()
What is a parse table representing?
scope_normalize()
Convert the styling scope to its lower-level representation

Other

print(<vertical>)
Print styled code