Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
414 changes: 414 additions & 0 deletions claude-notes/plans/2026-07-29-pre-post-render-scripts.md

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions crates/quarto-core/src/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ pub use traits::ExecutionEngine;
pub use jupyter::JupyterEngine;
#[cfg(not(target_arch = "wasm32"))]
pub use knitr::KnitrEngine;
// Rscript discovery, shared with the project render-script dispatcher
// (`project::render_scripts`).
#[cfg(not(target_arch = "wasm32"))]
pub(crate) use knitr::find_rscript;

/// Print `perf.engine-discover jupyter=N rscript=N` to stderr when
/// `QUARTO_PERF_STATS=1`. Call once at the end of a top-level
Expand Down
19 changes: 19 additions & 0 deletions crates/quarto-core/src/project/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub mod listing;
pub mod orchestrator;
pub mod pass2_renderer;
pub mod profile_cache;
pub mod render_scripts;
pub mod sidebar_membership;
pub mod website_config;
// Every hook in this module is native-only (`#[cfg(not(wasm32))]`
Expand Down Expand Up @@ -332,6 +333,19 @@ pub struct ProjectConfig {
/// Empty when `project.resources` is absent.
pub resources: Vec<crate::project_resources::RawResourcePattern>,

/// `project.pre-render` script entries (bd-w348iu63): command
/// lines run before a project render, in declaration order, with
/// each entry's YAML source location. A bare string normalizes to
/// a one-element list. Empty when the key is absent (including
/// single-file pseudo-projects, which never run scripts). See
/// [`render_scripts`] for the execution contract.
pub pre_render_scripts: Vec<render_scripts::RenderScript>,

/// `project.post-render` script entries — run after a successful
/// project render. Same shape as
/// [`pre_render_scripts`](Self::pre_render_scripts).
pub post_render_scripts: Vec<render_scripts::RenderScript>,

/// Full project metadata as ConfigValue with source tracking.
///
/// This is the entire `_quarto.yml` parsed with `InterpretationContext::ProjectConfig`,
Expand Down Expand Up @@ -656,6 +670,9 @@ impl ProjectContext {
&["project", "resources"],
);

let pre_render_scripts = render_scripts::extract_render_scripts(&metadata, "pre-render");
let post_render_scripts = render_scripts::extract_render_scripts(&metadata, "post-render");

// Resolve the project-level `brand:` once, here, so every
// site-wide consumer reads the same answer. Relative brand
// paths are written against the directory holding this
Expand All @@ -674,6 +691,8 @@ impl ProjectContext {
output_dir,
render_patterns,
resources,
pre_render_scripts,
post_render_scripts,
metadata: Some(metadata),
config_path: Some(path.to_path_buf()),
brand,
Expand Down
Loading
Loading