View source: R/html_dependency.R
htmlDependency( name, version, src, meta = NULL, script = NULL, stylesheet = NULL, head = NULL, attachment = NULL, package = NULL, all_files = TRUE )
Unnamed single-element character vector indicating the full path of the library directory. Alternatively, a named character string with one or more elements, indicating different places to find the library; see Details.
Named list of meta tags to insert into document head
Script(s) to include within the document head (should be
specified relative to the
Stylesheet(s) to include within the document (should be
specified relative to the
Arbitrary lines of HTML to insert into the document head
Attachment(s) to include within the document head. See Details.
An R package name to indicate where to find the
Whether all files under the
Each dependency can be located on the filesystem, at a relative or
absolute URL, or both. The location types are indicated using the names of
src character vector:
file for filesystem directory,
href for URL. For example, a dependency that was both on disk and at
a URL might use
src = c(file=filepath, href=url).
script can be given as one of the following:
a character vector specifying various scripts to include relative to the
Each is expanded into its own
A named list with any of the following fields:
any other valid
allowing the use of SRI to ensure the integrity of packages downloaded from
script = list(src = "min.js", integrity = "hash")
An unnamed list, containing a combination of named list with the fields mentioned previously, and strings. Eg:
script = list(list(src = "min.js"), "util.js", list(src = "log.js"))
script = "pkg.js" is equivalent to
script = list(src = "pkg.js").
attachment can be used to make the indicated files available to the
<link id="DEPNAME-ATTACHINDEX-attachment" rel="attachment" href="..."> is inserted, where
name. The value of
ATTACHINDEX depends on whether
attachment is named or not; if
so, then it's the name of the element, and if not, it's the 1-based index
document.getElementById(depname + "-" + index + "-attachment").href.
Note that depending on the rendering context, the runtime value of the href
may be an absolute, relative, or data URI.
htmlDependency should not be called from the top-level of a package
namespace with absolute paths (or with paths generated by
system.file()) and have the result stored in a variable. This is
because, when a binary package is built, R will run
and store the path from the building machine's in the package. This path is
likely to differ from the correct path on a machine that downloads and
installs the binary package. If there are any absolute paths, instead of
htmlDependency at build-time, it should be called at
run-time. This can be done by wrapping the
htmlDependency call in a
An object that can be included in a list of dependencies passed to
attachDependencies() to associate a list of
dependencies with the HTML it belongs with.
The shape of the
htmlDependency object is described (in TypeScript code)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.