Description Usage Arguments Details Examples
Add multiple snippets, in the form of a named list, to a .snippets file.
1 | snippets_add(snippets, language = "r", path = snippets_path(language))
|
snippets |
list of snippets to add |
language |
language of the snippet. Choices are "r", "c_cpp", "html",
"css", "java", "javascript", "python", and "sql". Ignored if |
path |
path to .snippets file |
Note that a .snippets file for a language may not yet exist. If it does not exist, go to Preferences->Code->Edit Snippets in RStudio, make a trivial change to the language of choice (for example, a new empty line), and click Save. This will create the language file in ~/.R/snippets/<language>.snippets with defaults included.
1 2 3 4 5 6 7 8 9 10 11 | ## Not run:
# add a .r snippet
snippets_add(list(dplyr = "${1:object} <- ${1:object} %>%\n${2:function}"))
# add an HTML snippet
snp <- "<span style = 'font-size: 10px'>Copyright 2015</span>"
snippet_add(list("copyright", snp, language = "html"))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.