mdsmith
Esc
    v0.52.0 GitHub

    mdsmith check

    Lint Markdown files for style issues.

    Walks the workspace, parses each file once, runs every configured rule, and prints diagnostics — without writing anything back. Also covers structure and cross-file integrity, not only line-level style.

    mdsmith check [flags] [files...]

    Files can be paths, directories (walked recursively for *.md and *.markdown), or glob patterns. Pass - to read from stdin. With no file arguments, files are discovered from .mdsmith.yml files: patterns (default: **/*.md, **/*.markdown).

    # Flags

    FlagDefaultDescription
    -c, --configautoOverride config path (auto-discovers)
    -f, --formattexttext or json
    --max-input-size2MBMax file size (e.g. 2MB, 0=none)
    --no-colorfalsePlain output
    --follow-symlinksconfigFollow symlinks; tri-state — see below
    --no-gitignorefalseSkip gitignore filtering
    -q, --quietfalseSuppress non-error output
    -v, --verbosefalseShow config, files, and rules
    --explainfalseAttach per-leaf rule provenance

    --follow-symlinks is tri-state. Omitted defers to the config key (default: skip). --follow-symlinks or =true opts in for this run. =false forces skip even when config opts in.

    Symlinks resolving to directories, FIFOs, devices, or sockets are always skipped.

    --explain adds an explanation field to each JSON diag (or a └─ trailer in text output) naming the rule and the winning source for each leaf setting:

    "explanation": {"rule": "line-length", "leaves": [
      {"path": "enabled", "value": true, "source": "default"},
      {"path": "settings.max", "value": 30, "source": "kinds.short"}
    ]}

    # Examples

    mdsmith check docs/                  # lint a directory
    mdsmith check -f json docs/          # JSON output
    mdsmith check --explain README.md    # provenance trailer
    echo "# Hi" | mdsmith check -        # lint stdin

    # Pre-commit

    # lefthook.yml
    pre-commit:
      commands:
        mdsmith:
          glob: "*.{md,markdown}"
          run: mdsmith check {staged_files}

    # Exit codes

    CodeMeaning
    0No lint issues found
    1Lint issues found
    2Runtime or configuration error

    # See also