Command line

Modes, output, exit status, and generated command-line help.

Use Usage for common commands and Formatting settings to find a control by the output it changes. This command-line interface (CLI) reference includes help screens generated from the current Yamark binary.

Modes, output, and status

Mode Files stdout stderr
yamark format PATHS Writes changed files. Summary. Failures and requested diagnostics.
yamark format --check PATHS Does not write. - Summary, failures, and requested diagnostics.
yamark format --diff PATHS Does not write. Unified diffs. Summary, failures, and requested diagnostics.
yamark format --stdin-file-path PATH Does not read or write PATH; uses it to select file-aware behavior for stdin. Formatted content only. Failures and requested diagnostics.
yamark to-yaml --stdin-file-path PATH Does not read or write PATH; uses its JSON-family suffix to parse stdin. Formatted YAML only. Failures.

--check and --diff exit 1 when any selected file would change. Every mode exits 1 when formatting fails and 0 on success otherwise. Invalid command syntax exits 2.

When PATHS is omitted from yamark format, Yamark uses the current directory (.). Format path mode counts unsupported extensions as skipped without failing. An unsupported --stdin-file-path is an error because stdin mode requires a supported file type.

Format stdin mode rejects additional paths and cannot be combined with --check or --diff. yamark to-yaml always reads stdin, requires a .json, .jsonc, .json5, .jsonl, or .ndjson path hint, and never reads or writes that path.

Generated help

yamark

A fast formatter for YAML and Markdown.

Run `yamark <COMMAND> --help` for command-level help.

Usage: yamark <COMMAND>

Commands:
  format
  to-yaml     Convert JSON-family input from stdin to formatted YAML
  git-filter  Git clean/smudge filter helpers for Markdown files
  help        Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help (see a summary with '-h')

yamark format

Usage: yamark format [OPTIONS] [PATHS]...

Arguments:
  [PATHS]...

Options:
      --check
      --diff
      --diagnostics
      --stdin-file-path <PATH>
      --config <PATH>
      --wrap <WRAP>                  [default: 72]
      --canonical
      --preserve-footnotes
      --line-width <LINE_WIDTH>      [default: 80]
      --prose-width <PROSE_WIDTH>    [default: 72]
      --indent-width <INDENT_WIDTH>  [default: 2]
      --compact
      --skip-embedded-formatters
  -h, --help                         Print help

yamark to-yaml

Convert JSON-family input from stdin to formatted YAML

Usage: yamark to-yaml [OPTIONS] --stdin-file-path <PATH>

Options:
      --stdin-file-path <PATH>
      --config <PATH>
      --line-width <LINE_WIDTH>      [default: 80]
      --prose-width <PROSE_WIDTH>    [default: 72]
      --indent-width <INDENT_WIDTH>  [default: 2]
      --compact
  -h, --help                         Print help

yamark git-filter

Git clean/smudge filter helpers for Markdown files.

These commands read Markdown from stdin and write formatted Markdown to stdout
for Git attributes filters.

Configure the filter driver with:
  yamark git-filter adopt
  yamark git-filter join
  yamark git-filter check
  yamark git-filter setup
  yamark git-filter teardown
  git config filter.yamark-md.clean "yamark git-filter clean --stdin-filename %f"
  git config filter.yamark-md.smudge "yamark git-filter smudge --stdin-filename %f --markdown-wrap-at-column 72"

Git only runs the filter for paths matched by attributes. Put these patterns in
.git/info/attributes for personal use or .gitattributes for a shared repo:
  *.md filter=yamark-md
  *.qmd filter=yamark-md
  *.Rmd filter=yamark-md
  *.rmd filter=yamark-md

Usage: yamark git-filter <COMMAND>

Commands:
  clean
  smudge
  adopt     Adopt the yamark Git filter for a shared repository
  join      Join a repository that has already adopted the yamark Git filter
  check     Check committed yamark Git filter blobs round-trip safely
  setup     Configure the yamark Git filter in a repository
  teardown  Remove the local yamark Git filter setup from a repository
  help      Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help (see a summary with '-h')