Nothing
Note: please ignore this example if the version of your formatR package is greater than 1.3.2
, because line breaks will be automatically preserved.
This demos shows you how to replace \n
to a real line break in the source.
This is what you normally see in the output:
x = 'this is a long long string with several lines'
Modify the source
hook:
library(knitr) knit_hooks$set(source = function(x, options) { paste0('\n\n```r\n', gsub('\\n', '\n', x, fixed=TRUE), '\n```\n\n') })
Now we test the source
hook:
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.