Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

output_format

Define an R Markdown output format


Description

Define an R Markdown output format based on a combination of knitr and pandoc options.

Usage

output_format(
  knitr,
  pandoc,
  keep_md = FALSE,
  clean_supporting = TRUE,
  df_print = NULL,
  pre_knit = NULL,
  post_knit = NULL,
  pre_processor = NULL,
  intermediates_generator = NULL,
  post_processor = NULL,
  on_exit = NULL,
  file_scope = NULL,
  base_format = NULL
)

Arguments

knitr

Knitr options for an output format (see knitr_options)

pandoc

Pandoc options for an output format (see pandoc_options)

keep_md

Keep the markdown file generated by knitting. Note that if this is TRUE then clean_supporting will always be FALSE.

clean_supporting

Cleanup any supporting files after conversion see render_supporting_files

df_print

Method to be used for printing data frames. Valid values include "default", "kable", "tibble", and "paged". The "default" method uses a corresponding S3 method of print, typically print.data.frame. The "kable" method uses the knitr::kable function. The "tibble" method uses the tibble package to print a summary of the data frame. The "paged" method creates a paginated HTML table (note that this method is only valid for formats that produce HTML). In addition to the named methods you can also pass an arbitrary function to be used for printing data frames. You can disable the df_print behavior entirely by setting the option rmarkdown.df_print to FALSE. See Data frame printing section in bookdown book for examples.

pre_knit

An optional function that runs before knitting which receives the input (input filename passed to render) and ... (for future expansion) arguments.

post_knit

An optional function that runs after knitting which receives the metadata, input_file, runtime, and ... (for future expansion) arguments. This function can return additional arguments to pass to pandoc and can call knitr::knit_meta_add to add additional dependencies based on the contents of the input_file or on other assets side by side with it that may be used to produce html with dependencies during subsequent processing.

pre_processor

An optional pre-processor function that receives the metadata, input_file, runtime, knit_meta, files_dir, and output_dir and can return additional arguments to pass to pandoc.

intermediates_generator

An optional function that receives the original input_file, and the intermediates directory (i.e. the intermediates_dir argument to render). The function should generate and return the names of any intermediate files required to render the input_file.

post_processor

An optional post-processor function that receives the metadata, input_file, output_file, clean, and verbose parameters, and can return an alternative output_file.

on_exit

A function to call when rmarkdown::render() finishes execution (as registered with a on.exit handler).

file_scope

A function that will split markdown input to pandoc into multiple named files. This is useful when the caller has concatenated a set of Rmd files together (as bookdown does), and those files may need to processed by pandoc using the --file-scope option. The function should return a named list of files w/ name and content for each file.

base_format

An optional format to extend.

Value

An R Markdown output format definition that can be passed to render.

See Also

Examples

## Not run: 
output_format(knitr = knitr_options(opts_chunk = list(dev = 'png')),
              pandoc = pandoc_options(to = "html"))

## End(Not run)

rmarkdown

Dynamic Documents for R

v2.10
GPL-3
Authors
JJ Allaire [aut], Yihui Xie [aut, cre] (<https://orcid.org/0000-0003-0645-5666>), Jonathan McPherson [aut], Javier Luraschi [aut], Kevin Ushey [aut], Aron Atkins [aut], Hadley Wickham [aut], Joe Cheng [aut], Winston Chang [aut], Richard Iannone [aut] (<https://orcid.org/0000-0003-3925-190X>), Andrew Dunning [ctb] (<https://orcid.org/0000-0003-0464-5036>), Atsushi Yasumoto [ctb, cph] (<https://orcid.org/0000-0002-8335-495X>, Number sections Lua filter), Barret Schloerke [ctb], Carson Sievert [ctb] (<https://orcid.org/0000-0002-4958-2844>), Christophe Dervieux [ctb], Devon Ryan [ctb] (<https://orcid.org/0000-0002-8549-0971>), Frederik Aust [ctb] (<https://orcid.org/0000-0003-4900-788X>), Jeff Allen [ctb], JooYoung Seo [ctb] (<https://orcid.org/0000-0002-4064-6012>), Malcolm Barrett [ctb], Rob Hyndman [ctb], Romain Lesur [ctb], Roy Storey [ctb], Ruben Arslan [ctb], Sergio Oller [ctb], RStudio, PBC [cph], jQuery Foundation [cph] (jQuery library), jQuery contributors [ctb, cph] (jQuery library; authors listed in inst/rmd/h/jquery-AUTHORS.txt), jQuery UI contributors [ctb, cph] (jQuery UI library; authors listed in inst/rmd/h/jqueryui-AUTHORS.txt), Mark Otto [ctb] (Bootstrap library), Jacob Thornton [ctb] (Bootstrap library), Bootstrap contributors [ctb] (Bootstrap library), Twitter, Inc [cph] (Bootstrap library), Alexander Farkas [ctb, cph] (html5shiv library), Scott Jehl [ctb, cph] (Respond.js library), Ivan Sagalaev [ctb, cph] (highlight.js library), Greg Franko [ctb, cph] (tocify library), John MacFarlane [ctb, cph] (Pandoc templates), Google, Inc. [ctb, cph] (ioslides library), Dave Raggett [ctb] (slidy library), W3C [cph] (slidy library), Dave Gandy [ctb, cph] (Font-Awesome), Ben Sperry [ctb] (Ionicons), Drifty [cph] (Ionicons), Aidan Lister [ctb, cph] (jQuery StickyTabs), Benct Philip Jonsson [ctb, cph] (pagebreak Lua filter), Albert Krewinkel [ctb, cph] (pagebreak Lua filter)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.