> # Parsing failure > cat(evaluate_and_highlight("1 + "))
NA
#> Error: <text>:2:0: unexpected end of input #> 1: 1 + #> ^
> # Basic ouput > cat(evaluate_and_highlight("# comment"))
# comment
> cat(evaluate_and_highlight("message('x')"))
message('x')
#> x
> cat(evaluate_and_highlight("warning('x')"))
warning('x')
#> Warning: x
> cat(evaluate_and_highlight("stop('x', call. = FALSE)"))
stop('x', call. = FALSE)
#> Error: x
> # Plots > fig_save <- (function(plot, id) list(path = paste0(id, ".png"), width = 10, + height = 10)) > f1 <- (function() plot(1)) > f2 <- (function() lines(0:2, 0:2)) > cat(evaluate_and_highlight("f1()\nf2()", fig_save = fig_save, env = environment()))
f1()
f2()