Skip to main content

load

Function load 

Source
pub fn load(
    explicit: Option<&Path>,
    start_dir: &Path,
    input_file: Option<&Path>,
) -> Result<(Config, Option<PathBuf>)>
Expand description

Load configuration with precedence:

  1. explicit path (error if unreadable/invalid)
  2. walk up from start_dir: .panache.toml, panache.toml
  3. XDG: $XDG_CONFIG_HOME/panache/config.toml or ~/.config/panache/config.toml
  4. default config

Flavor detection logic (when input_file is provided):

  • .qmd files: Always use Quarto flavor
  • .Rmd files: Always use RMarkdown flavor
  • Markdown-family files (.md/.markdown/.mdown/.mkd): Use most-specific flavor-overrides match when provided, else use flavor from config
  • Other extensions: Use flavor from config

The flavor config field determines the default flavor for stdin and files without a matching extension override.