A CLI formatter for Quarto (.qmd
), Pandoc, and Markdown files.
This project is in very early development. Expect bugs, missing features, and breaking changes.
cargo install --path .
# Format a file and output to stdout
quartofmt document.qmd
# Format a file in place
quartofmt --write document.qmd
# Check if a file is formatted
quartofmt --check document.qmd
# Format from stdin
quartofmt document.qmd | cat
quartofmt looks for a configuration in:
.quartofmt.toml
orquartofmt.toml
in current directory or parent directories~/.config/quartofmt/config.toml
line_width = 80
line-ending = "auto"
I wanted a formatter that understands Quarto and Pandoc syntax. I have tried to use Prettier as well as mdformat, but both fail to handle some of the particular syntax used in Quarto documents, such as fenced divs and some of the table syntax.
- Support Quarto, Pandoc, and Markdown syntax
- Be fast
- Be configurable, but have sane defaults (that most people can agree on)
- Format math
Notably, I don't expect to support formatting the code blocks or yaml frontmatter. The primary reason for this is that it is now possible to do this already by language injection through tree sitter, for instance, which means that a good formatter should already be able to handle this.