I'm producing an RMarkdown document with knitr, and I'd like to give my readers the option to show/hide code blocks.
I assume that this will involve adding some JavaScript (e.g. toggle_visibility
), but I'm not sure how to add it to a knitr document. Would I add it to the CSS somehow? Or return something with asis = TRUE
and put the JavaScript there, as in this example?
Thanks in advance for your help.