#' Run only selected lines
#'
#' @export
#'
runpy <- function(){
context <- rstudioapi::getActiveDocumentContext()
if(context$selection[[1]]$text!=""){
PythonInR::pyExec(context$selection[[1]]$text)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.