The button can self-contain the input data by base64 encoding.

download_rmd_button(
  input = NULL,
  text = "Download Rmd",
  ...,
  class = "button",
  align = "right",
  aside = TRUE,
  embed = NULL
)

Arguments

input

Filename of the input. If NULL, the function automatically detects the name of the knitting Rmd file.

text

The text for the hyperlink.

...

Arguments passed to the embed function.

class

HTML class(es) given to the anchor element generated by embed (default: "button").

align

Align the button by CSS's text-align attribute. This feature is disabled when aside is FALSE

aside

Whether to wrap the anchor element by the aside element.

embed

A function to embed file(s). One of xfun::embed_file, xfun::embed_files, or xfun::embed_dir.

Value

shiny.tag class object.

Examples

set.seed(1L)

input <- tempfile()
writeLines("", input)
download_rmd_button(input)
#> <aside style="text-align:right">
#>   <a href="data:text/plain;base64,Cg==" download="file91c1d4ae600" class="button">Download Rmd</a>
#> </aside>

# Requires zip command
if (interactive()) {
  input <- tempdir()
  download_rmd_button(input, embed = xfun::embed_dir)
}