stylerignore {styler}R Documentation

Turn off styling for parts of the code

Description

Using stylerignore markers, you can temporarily turn off styler. Beware that for ⁠styler > 1.2.0⁠, some alignment is detected by styler, making stylerignore redundant. See a few illustrative examples below.

Details

Styling is on for all lines by default when you run styler.

Examples

# as long as the order of the markers is correct, the lines are ignored.
style_text(
  "
  1+1
  # styler: off
  1+1
  # styler: on
  1+1
  "
)

# if there is a stop marker before a start marker, styler won't be able
# to figure out which lines you want to ignore and won't ignore anything,
# issuing a warning.
## Not run: 
style_text(
  "
  1+1
  # styler: off
  1+1
  # styler: off
  1+1
  "
)

## End(Not run)
# some alignment of code is detected, so you don't need to use stylerignore
style_text(
  "call(
    xyz =  3,
    x   = 11
  )"
)

[Package styler version 1.10.3 Index]