cli
cli copied to clipboard
Feature request: fallback to a default `code_highlight()` theme if RStudio theme is unavailable
If you try to use code_highlight() in RStudio when using a theme that is not included in code_theme_list(), you receive a warning message and the code is returned unhighlighted:
cli::code_highlight("1 + 1")
#> [1] "1 + 1"
#> Warning message:
#> In code_theme_default_rstudio() :
#> cli does not know this RStudio theme: a11y-dark {rsthemes}
It would be preferable to fallback to a default theme if cli does not recognize the current RStudio theme: perhaps to cli:::code_theme_default_term() or "Textmate (default)".
The warning message could be preserved and could also indicate that the user can choose a code highlighting theme using options().
Thanks, makes sense. Do you want to submit a PR? No pressure. :)
Sure, I can put that together!