R/pandoc_write.R

Defines functions pandoc_write

Documented in pandoc_write

#' Write a `Pandoc` File
#'
#' @param pandoc internal `Pandoc` representation
#' @param to output format (supported by `Pandoc`)
#'
#' @return the converted text
#' @export
pandoc_write <- function(pandoc, to = pandoc_output_formats()) {
  to <- match.arg(to)
  args <- sprintf("-f json -t %s", shQuote(to))
  pandoc <- paste0(pandoc, collapse = "")
  paste(system2(pandoc(), args, input = pandoc, stdout=TRUE, stderr=TRUE), collapse = "\n")
}

Try the flexsiteboard package in your browser

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

flexsiteboard documentation built on Nov. 16, 2022, 1:11 a.m.