reprex
reprex copied to clipboard
Warning exists when `reprex(... style = FALSE)`
With style=FALSE, users would like to render without styler. I wonder if "Install the styler package" should still show up?
reprex::reprex({ print("") }, style = FALSE)
#> ✖ Install the styler package in order to use `style = TRUE`.
#> ℹ Non-interactive session, setting `html_preview = FALSE`.
#> ℹ Rendering reprex...
Created on 2024-02-02 with reprex v2.1.0
Yeah this appears to be a thinko in this helper. It doesn't seem to consult whether style is TRUE or FALSE 🙈
https://github.com/tidyverse/reprex/blob/e1f65e9949ed30d1ee4f1e984736b408d8e001ee/R/reprex_impl.R#L129-L137
Our users asked us if they should install styler since they got this "warning". Maybe:
style_requires_styler <- function(style) {
if (style && !requireNamespace("styler", quietly = TRUE)) {
reprex_danger("
Install the {.pkg styler} package in order to use
{.code style = TRUE}.")
style <- FALSE
}
invisible(style)
}
?
Yes LGTM. Would you like to make a PR?