New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syntax highlighting in print.vertical() #417

Closed
wlandau opened this Issue Aug 18, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@wlandau

wlandau commented Aug 18, 2018

It would be nice to see syntax highlighting when I print out styled code in the console and in knitr / R Markdown reports:

styler::style_text("
function(x){
  x * (sqrt(5) + 1) / 2 
}
")
#> 
#> function(x) {
#>   x * (sqrt(5) + 1) / 2
#> }

Motivating use case: ropensci/drake#489. Packages that may help:

@lorenzwalthert

This comment has been minimized.

Collaborator

lorenzwalthert commented Aug 18, 2018

Thanks for raising the issue and putting all the references here, really appreciate that. In fact, this should be straightforward. See my branch highlight-print-vertical for a primer. Using prettycode::highlight() seems to be a good solution. Have not tested the others. The dependency would probably be added under Suggests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment