#' Script path
#'
#' @export
#' @note Only currently works inside RStudio.
#' @note Updated 2022-10-20.
#'
#' @return `character(1)`.
#' Normalized path to current script.
#'
scriptPath <- function() {
stopifnot(
.requireNamespaces("rstudioapi"),
.isRstudio()
)
x <- rstudioapi::getSourceEditorContext()[["path"]]
stopifnot(.isAFile(x))
x <- .realpath(x)
x
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.