getActiveDoc <- function() {
fn = rstudioapi::getActiveDocumentContext()$path
Encoding(fn) ='UTF-8'
if (grepl('\\.[Rr]?md$', fn)) fn else ''
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.