Runs input files through Quarto or RMarkdown, and allows Quarto to work with full paths (where Quarto itself requires relative paths). This function essentially replaces both rmarkdown::render() and quarto::quarto_render().

render(input_file, output_file = NULL, quiet = FALSE, ...)

knit(input_file, output_file = NULL, quiet = FALSE, ...)

render_sharepoint(
  input_file = NULL,
  output_file = NULL,
  project_number = project_get_current_id(),
  full_sharepoint_path = NULL,
  quiet = FALSE,
  account = connect_teams(),
  output_folder = get_output_folder(project_number = project_number, account = account),
  upload = FALSE,
  ...
)

Arguments

input_file

file to be rendered, can be R Markdown (.Rmd) or Quarto (.qmd), or a lot of other formats such as .md, .ipynb and many other formats that Quarto supports.

output_file

Base name for single-file output (e.g. PDF, ePub, MS Word). This sets the output-file Quarto metadata. If NULL, the output filename will be based on the input filename.

quiet

Suppress warning and other messages, from R and also Quarto CLI (i.e --quiet is passed as command line).

quarto.quiet R option or R_QUARTO_QUIET environment variable can be used to globally override a function call (This can be useful to debug tool that calls quarto_* functions directly).

On Github Actions, it will always be quiet = FALSE.

...

arguments passed on to render()

project_number

Planner project number

full_sharepoint_path

Full path of the remote file, consisting of the project folder and the file name, such as "Project - p123/my_file.R".

account

a Microsoft 365 account to use for looking up properties. This has to be an object as returned by connect_teams() or Microsoft365R::get_team().

output_folder

any output folder of the resulting output file, defaults to get_output_folder(). Can also be "sharepoint", which sets upload = TRUE.

upload

whether to upload the resulting output file back to SharePoint, default is FALSE.

Value

As opposed to quarto::quarto_render(), which always returns NULL, this render() function always returns the output file name (invisibly).

Details

Functions knit() and render() are identical.

Any Quarto file (.qmd) will be rendered using quarto::quarto_render(). Any RMarkdown file (.Rmd) will be rendered using rmarkdown::render().

render_sharepoint() downloads a SharePoint project file to a local temporary folder, then renders it. Either input_file + project_number or full_sharepoint_path must be given.