Expand description
The prim formatting engine.
prim is an opinionated, near-zero-config formatter for a repository’s connective tissue — Markdown, JSON/JSONC, YAML, TOML — plus whitespace hygiene on a curated set of un-owned text files.
The engine has two steps:
classifydecides whether prim owns a file (by name/extension) and, if so, whatFileKindit is. Files prim does not own are left untouched.- [
format] applies the canonical formatting for that kind.
[format] applies structured canonicalisation to the parsed formats —
JSON/JSONC via dprint-plugin-json, TOML via taplo, YAML via
pretty_yaml, Markdown via dprint-plugin-markdown — followed by the
format-agnostic whitespace hygiene pass (trailing-whitespace removal,
single final line-feed, configured line endings). Orphan files receive
hygiene only.
Structs§
- Style
- The resolved canonical style for one file.
Enums§
- File
Kind - The kind of file prim recognises. Parsed formats receive structured
canonicalisation plus whitespace hygiene;
Orphanfiles (the un-owned text allowlist) only ever receive whitespace hygiene. - Format
Error - An error returned by
crate::formatwhen a source cannot be formatted. - Indent
- Indentation unit. Carried for the per-format parsers (FR-1, #9–12); the whitespace-hygiene pass does not consume it.
- Line
Ending - The line ending prim emits.