Integrations
Use Panache with GitHub Actions, pre-commit hooks, and dprint to format and lint your documents.
Use Panache in CI, Git hooks, and other formatting tools. For editor setup, including RStudio, Mason, and Conform, see Editor Configuration.
GitHub Actions
Use panache-action to check formatting and lint documents in CI. It installs a prebuilt Panache binary on GitHub-hosted Linux, macOS, and Windows runners. Create .github/workflows/panache.yml:
name: Panache
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
jobs:
panache:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: jolars/panache-action@v1
with:
version: v3.14.0By default, the action checks formatting and runs the linter over the repository’s supported documents without changing files. Formatting differences or lint findings fail the check. It uses the CLI’s configuration discovery and file selection, including .gitignore and configured exclusions. Install any external formatters or linters selected in panache.toml before running the action.
The @v1 tag selects the action version; version selects the Panache CLI release. Keep the latter aligned with your local installation and pre-commit revision. Omitting version selects latest.
For a formatting-only check under docs/:
- uses: jolars/panache-action@v1
with:
version: v3.14.0
path: docs/
lint: "false"Set format: "false" to run only linting, or config: path/to/panache.toml to select a configuration file. See the action reference for the inputs and outputs supported by @v1.
The published @v1 action invokes panache format --check and panache lint --check. The latter flag is a deprecated compatibility alias; when writing your own CI commands, use panache lint ..
Manual setup (advanced)
You can also install through Cargo and invoke the checks yourself:
name: Panache
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
jobs:
panache:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- name: Install Panache
run: cargo install --locked panache --version 3.14.0
- name: Check formatting
run: panache format --check .
- name: Run linter
run: panache lint .pre-commit
panache-pre-commit runs Panache on staged documents. The hooks install a prebuilt binary wheel from PyPI, so no separate Panache or Rust installation is needed. Any configured external tools must be installed separately and available on PATH.
Install pre-commit, then add this entry to .pre-commit-config.yaml:
repos:
- repo: https://github.com/jolars/panache-pre-commit
rev: v3.14.0
hooks:
- id: panache-lint
- id: panache-formatInstall the Git hook and run it once over all tracked files:
pre-commit install
pre-commit run --all-filesOn subsequent commits, both hooks select staged .qmd, .Rmd, .md, .markdown, .mdown, and .mkd files. panache-lint reports findings, and panache-format formats files in place. When a hook changes a file, review and stage the changes, then commit again.
To apply safe lint fixes, add --fix to the lint hook and keep it before formatting:
hooks:
- id: panache-lint
args: [--fix]
- id: panache-formatTo check formatting without changing files, add args: [--check] to panache-format.
Both hooks pass --force-exclude, so configured exclusions apply even though pre-commit supplies filenames explicitly. They discover panache.toml as the CLI does. To select another config, add args: [--config, custom-config.toml] to each hook.
File Patterns
The hook patterns are case-sensitive. For example, they do not select .rmd, .Rmarkdown, or .rmarkdown by default, although Panache supports those files. Override files on both hooks to cover them:
repos:
- repo: https://github.com/jolars/panache-pre-commit
rev: v3.14.0
hooks:
- id: panache-lint
files: '\.(qmd|md|markdown|mdown|mkd|[Rr]md|[Rr]markdown)$'
- id: panache-format
files: '\.(qmd|md|markdown|mdown|mkd|[Rr]md|[Rr]markdown)$'The rev selects the Panache release: v3.14.0 installs Panache 3.14.0. Run pre-commit autoupdate to update hook revisions, then review and commit the changes to .pre-commit-config.yaml.
dprint
Format Markdown and Quarto documents alongside other languages with dprint and the Panache dprint plugin. The plugin bundles Panache’s formatter as WebAssembly, so no Panache CLI installation is needed.
Install dprint. If your project has no dprint.json, create one with dprint init, then add Panache:
dprint config add jolars/panacheCommit the versioned, checksummed plugin URL that the command adds to dprint.json. Run dprint fmt to format files in place or dprint check to check without changing files. The check fails when files need formatting. Both commands run all configured plugins; Panache handles .md, .qmd, .Rmd, .rmd, .Rmarkdown, .rmarkdown, .markdown, .mdown, and .mkd files.
Add settings under panache, keeping the plugins array created above:
{
"panache": {
"wrap": "sentence",
"lineWidth": 88
}
}The plugin uses Quarto rules for .qmd files and R Markdown rules for .rmd and .rmarkdown files, regardless of the configured flavor. Other extensions use flavor, which defaults to pandoc.
The plugin accepts these settings under panache:
| Key | Values | Default |
|---|---|---|
flavor |
pandoc, quarto, rmarkdown, gfm, commonmark, multimarkdown |
pandoc |
wrap |
reflow, preserve, sentence, semantic |
reflow |
blankLines |
collapse, preserve |
collapse |
mathIndent |
Integer number of spaces | 2 |
mathDelimiterStyle |
preserve, dollars, backslash |
preserve |
tabStops |
normalize, preserve |
normalize |
lineEnding |
auto, lf, crlf |
auto |
lineWidth |
Integer; uses dprint’s global lineWidth when set |
80 |
tabWidth |
Integer; uses dprint’s global indentWidth when set |
4 |
The plugin reads dprint.json and does not load panache.toml. Use dprint’s top-level includes and excludes for file selection; Panache’s TOML exclusions do not apply. dprint also respects .gitignore. See dprint’s configuration guide.
The plugin provides document formatting and cannot launch Panache’s external formatters or linters. Use the CLI integrations above when code blocks need external tools or you need lint checks.
The plugin is released independently of the CLI. Run dprint config update, then review and commit the configuration changes. Matching CLI output requires the same panache-formatter version and equivalent settings, with external formatting disabled on the CLI side.