#' Quick paste a DiagrammeR template
#' @author Jiaxiang Li
#'
#' @import rstudioapi
diagrammer_shortcut <- function(){
text <- "```{r echo=FALSE}\nlibrary(DiagrammeR)\ngrViz(\"digraph course {\nrankdir = LR\nnode [shape = box, style=filled]\nlayout = dot\ncompound =true\n#color = crimson\n\nsubgraph clusterA{\nlabel = 'A'\nstyle = dashed\nrank = same\n\nb\nd\n\n}\n\nsubgraph clusterB{\nlabel = 'B'\nstyle = dashed\nrank = same\n\na\nc\n}\n\na -> b\nc -> d\n}\")\n```"
# use clipr::read_clip() to detect the writing.
rstudioapi::insertText(text)
cat(
sep="\n"
,text
,tips()
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.