R/preview.R

Defines functions insert_preview

Documented in insert_preview

#' Include a preview of the CV template output for documentation
#'
#' @param input Path to the CV's template rmd file
#' @keywords internal
insert_preview <- function(template) {
  preview <- paste0("preview-", template, ".png")
  if(!file.exists(file.path("man", "figures", preview))) {
    abort(paste0("Missing preview for ", template, ". Add it with render_preview(<template>) from data-raw/preview.R."))
  }

  knitr::asis_output(
    sprintf(
      "![](%s 'Template preview')",
      preview
    )
  )
}

Try the vitae package in your browser

Any scripts or data that you put into this service are public.

vitae documentation built on March 31, 2023, 9:33 p.m.