This function runs code
and captures the output using
evaluate::evaluate()
. It syntax highlights code with highlight()
,
and combines all results into a single HTML div.
evaluate_and_highlight( code, fig_save, classes = downlit::classes_pandoc(), env = NULL )
code | Code to evaluate (as a string). |
---|---|
fig_save | A function with arguments |
classes | A mapping between token names and CSS class names.
Bundled |
env | Environment in which to evaluate code; if not supplied, defaults to a child of the global environment. |
An string containing HTML.
evaluate_and_highlight("1 + 2")#> [1] "<div class='input'><span class='fl'>1</span> <span class='op'>+</span> <span class='fl'>2</span></div><div class='output co'>#> [1] 3</div>"