save_notebook()
Save a rendered notebook to the outputs directory
Renders a Quarto or R Markdown notebook and saves the output to the configured notebooks output directory. The directory is created lazily on first use.
Usage
save_notebook(
file,
name = NULL,
format = "html",
public = FALSE,
overwrite = TRUE,
embed_resources = TRUE,
...
)
Arguments
| Name | Description |
|---|---|
| file |
Path to the .qmd or .Rmd file to render |
| name |
Optional new name for the output file (without extension). If NULL, uses the original notebook name. |
| format |
Output format: "html" (default), "pdf", or "docx" |
| public |
If TRUE, saves to public outputs directory (for project_sensitive type) |
| overwrite |
If TRUE, overwrites existing files (default: TRUE) |
| embed_resources |
If TRUE, creates a self-contained file with embedded resources (default: TRUE for html format) |
| ... |
Additional arguments passed to quarto render |
Value
The path to the saved file (invisibly)
Examples
if (FALSE) {
# Render and save a notebook
save_notebook("notebooks/analysis.qmd")
# Save with a custom name
save_notebook("notebooks/analysis.qmd", name = "final_analysis")
# Render to PDF
save_notebook("notebooks/analysis.qmd", format = "pdf")
# Save to public directory (for sensitive projects)
save_notebook("notebooks/analysis.qmd", public = TRUE)
}