Debian Codegraph @

man/output_format.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/output_format.R
3 \name{output_format}
4 \alias{output_format}
5 \title{Define an R Markdown output format}
6 \usage{
7 output_format(
8 knitr,
9 pandoc,
10 keep_md = FALSE,
11 clean_supporting = TRUE,
12 df_print = NULL,
13 pre_knit = NULL,
14 post_knit = NULL,
15 pre_processor = NULL,
16 intermediates_generator = NULL,
17 post_processor = NULL,
18 on_exit = NULL,
19 file_scope = NULL,
20 base_format = NULL
21 )
22 }
23 \arguments{
24 \item{knitr}{Knitr options for an output format (see
25 \code{\link{knitr_options}})}
26
27 \item{pandoc}{Pandoc options for an output format (see
28 \code{\link{pandoc_options}})}
29
30 \item{keep_md}{Keep the markdown file generated by knitting. Note that if
31 this is \code{TRUE} then \code{clean_supporting} will always be
32 \code{FALSE}.}
33
34 \item{clean_supporting}{Cleanup any supporting files after conversion see
35 \code{\link{render_supporting_files}}}
36
37 \item{df_print}{Method to be used for printing data frames. Valid values
38 include "default", "kable", "tibble", and "paged". The "default" method
39 uses a corresponding S3 method of \code{print}, typically
40 \code{print.data.frame}. The "kable" method uses the
41 \code{\link[knitr:kable]{knitr::kable}} function. The "tibble" method uses
42 the \pkg{tibble} package to print a summary of the data frame. The "paged"
43 method creates a paginated HTML table (note that this method is only valid
44 for formats that produce HTML). In addition to the named methods you can
45 also pass an arbitrary function to be used for printing data frames. You
46 can disable the \code{df_print} behavior entirely by setting the option
47 \code{rmarkdown.df_print} to \code{FALSE}. See
48 \href{https://yihui.org/rmarkdown/html-document.html#data-frame-printing}{Data
49 frame printing section} in bookdown book for examples.}
50
51 \item{pre_knit}{An optional function that runs before knitting which receives
52 the \code{input} (input filename passed to \code{render}), \code{metadata}
53 (the parsed front matter of the Rmd file) and \code{...} (for future
54 expansion) arguments. This function can be used to add side effects before
55 knitting step.}
56
57 \item{post_knit}{An optional function that runs after knitting which receives
58 the \code{metadata}, \code{input_file}, \code{runtime}, and \code{...} (for
59 future expansion) arguments. This function can return additional arguments
60 to pass to pandoc and can call \code{knitr::knit_meta_add} to add
61 additional dependencies based on the contents of the input_file or on other
62 assets side by side with it that may be used to produce html with
63 dependencies during subsequent processing.}
64
65 \item{pre_processor}{An optional pre-processor function that receives the
66 \code{metadata}, \code{input_file}, \code{runtime}, \code{knit_meta},
67 \code{files_dir}, and \code{output_dir} and can return additional arguments
68 to pass to pandoc.}
69
70 \item{intermediates_generator}{An optional function that receives the
71 original \code{input_file}, and the intermediates directory (i.e. the
72 \code{intermediates_dir} argument to \code{\link{render}}). The function
73 should generate and return the names of any intermediate files required to
74 render the \code{input_file}.}
75
76 \item{post_processor}{An optional post-processor function that receives the
77 \code{metadata}, \code{input_file}, \code{output_file}, \code{clean}, and
78 \code{verbose} parameters, and can return an alternative
79 \code{output_file}.}
80
81 \item{on_exit}{A function to call when \code{rmarkdown::render()} finishes
82 execution (as registered with a \code{\link{on.exit}} handler).}
83
84 \item{file_scope}{A function that will split markdown input to pandoc into
85 multiple named files. This is useful when the caller has concatenated a set
86 of Rmd files together (as \pkg{bookdown} does), and those files may need to
87 processed by pandoc using the \code{--file-scope} option. The first
88 argument is input file paths and the second is \code{NULL} or current file
89 scope which is a named list of files w/ \code{name} and \code{content} for
90 each file. The return is the new file scope. Also, the arguments should
91 include \code{...} for the future extensions.}
92
93 \item{base_format}{An optional format to extend.}
94 }
95 \value{
96 An R Markdown output format definition that can be passed to
97 \code{\link{render}}.
98 }
99 \description{
100 Define an R Markdown output format based on a combination of knitr and pandoc
101 options.
102 }
103 \examples{
104 \dontrun{
105 output_format(knitr = knitr_options(opts_chunk = list(dev = 'png')),
106 pandoc = pandoc_options(to = "html"))
107 }
108 }
109 \seealso{
110 \link{render}, \link{knitr_options}, \link{pandoc_options}
111 }