format_qmd

runner.format_qmd(
    qmd_file,
    formatter,
    *,
    keep_temp_files=False,
    verbose=False,
    lint_non_exec=False,
)

Format Python code in a Quarto file.

This converts the input .qmd file into a temporary formatter-friendly .py file, runs the requested formatter on it, writes the formatted Python code back into the original .qmd file.

Parameters

Name Type Description Default
qmd_file str | Path Path to the .qmd file to process. required
formatter str Name of the supported formatter to run. required
keep_temp_files bool If True, keep the temporary .py file after processing. False
verbose bool If True, print verbose progress messages. False
lint_non_exec bool If True, also format non-executable Python code chunks. False

Returns

Name Type Description
int 0 on success, nonzero on error.