Skip to contents

styler functionality is available in other tools, most notably

  • as a pre-commit hook style-files in https://github.com/lorenzwalthert/precommit to format before commit (locally) and enforced as a continuous integration step in the cloud through https://pre-commit.ci.

  • via usethis::use_tidy_style() styles your project according to the tidyverse style guide.

  • through commenting a PR on GitHub with \style when the GitHub Action Tidyverse CI is used. The most convenient way to set this up is via usethis::use_tidy_github_actions().

  • through the GitHub Action Workflow that triggers styler::style_pkg() on changes in source files. Setting this up is easiest with usethis::use_github_action("style").

  • as a formatter for R Markdown without modifying the source. This feature is implemented as a code chunk option in knitr. use tidy = "styler" in the header of a code chunks (e.g.```{r name-of-the-chunk, tidy = "styler"}), or knitr::opts_chunk$set(tidy = "styler") at the top of your RMarkdown script.

  • via the R language server to format your code in VS Code, atom and others.

  • As a fixer to the ale Plug-in for VIM.

  • in reprex::reprex(..., style = TRUE) to prettify reprex code before printing. To permanently use style = TRUE without specifying it every time, you can add the following line to your .Rprofile (via usethis::edit_r_profile()): options(reprex.styler = TRUE).

  • in the format-all command for Emacs in emacs-format-all-the-code.

  • As a Jupyterlab code formatter.

  • for pretty-printing drake workflow data frames with drake::drake_plan_source().

Do you know another way to use styler that is not listed here? Please let us know by opening an issue and we’ll extend the list.