local_create_package <- function(dir = fs::file_temp(), env = parent.frame()) {
old_wd <- getwd()
usethis::create_package(dir, open = FALSE)
withr::defer(fs::dir_delete(dir), envir = env)
setwd(dir)
withr::defer(setwd(old_wd), envir = env)
dir
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.