TechArticle

wiki fmt

Infobox

headline
wiki fmt
description
Format markdown wiki pages using mdformat with wikilink preservation.

Format markdown wiki pages in-place using mdformat. Mechanical markdown style (ATX headings, list spacing, GFM tables, frontmatter layout) is configured under the top-level fmt key in wiki.yaml (or wiki.json).

Configuration

Inline fmt (default)

wiki init scaffolds inline fmt in wiki.yaml:

fmt:
  wrap: "no"
  end_of_line: lf
  extensions: [gfm, frontmatter, wikilink]

Keys and values follow mdformat configuration. Unknown keys fail at config load; invalid values fail at load or when wiki fmt reads TOML.

An empty mapping (fmt: {}) is valid and resolves to the same Wiki CLI fmt defaults as omitting fmt when no TOML file applies (wrap: "no", end_of_line: lf, extensions gfm, frontmatter, wikilink).

Pointer mode (optional TOML file)

Instead of an inline mapping, set fmt to a relative path from the config file directory:

fmt: .mdformat.toml

Create the file beside wiki.yaml with the same keys as inline fmt (for example wrap = "no", end_of_line = "lf", extensions = ["gfm", "frontmatter", "wikilink"]). Absolute paths are rejected at config load.

Resolution order

wiki fmt stops at the first source below. Inline fmt always wins — it never merges with a .mdformat.toml on disk.

  1. Inlinefmt: mapping in wiki.yaml (fmt: {} counts as inline and uses Wiki CLI defaults)
  2. Pointer — TOML at the relative path in fmt:
  3. Wiki TOMLconfig_root/.mdformat.toml when fmt is omitted or the pointer file is missing
  4. Parent walk — nearest .mdformat.toml above the markdown file (mdformat behavior)
  5. Defaults — Wiki CLI fmt defaults (wrap: "no", end_of_line: lf, gfm / frontmatter / wikilink)

wiki fmt -v prints which step matched (for example Using inline fmt in wiki config.).

Concern Command Config
Mechanical markdown wiki fmt fmt: in wiki.yaml (inline or path)
Editorial conventions wiki lint wiki.yamllint:
Link integrity wiki lint wiki.yamllint:
Dynamic SPARQL tables wiki render (query-driven; blocks are left untouched by fmt)

Recommended CI order: fmt --checklint --strictcheck --strictrender --check.

Usage

wiki fmt
wiki fmt wiki/Some_Page.md
wiki fmt --check
wiki fmt -v

From another directory, pass the config path on the main command:

wiki --config docs fmt -v

Options

Flag Description
FILE... Optional markdown paths; otherwise entire wiki
--check Check formatting without modifying files; exits 1 if formatting is needed
-v, --verbose Print fmt config source and formatted files

Backlinks