文档

markdown-lint

试用

Check markdown files for common issues including heading structure, link validity, list formatting, trailing whitespace, and code block language tags. Use when reviewing documentation, README files, or any .md file for consistency and best practices.

它能做什么

Check markdown files for common issues including heading structure, link validity, list formatting, trailing whitespace, and code block language tags. Use when reviewing documentation, README files, or any .md file for consistency and best practices.

技能文档

Markdown Lint Skill

Static analysis for markdown files. Detects structural issues, broken links, and formatting inconsistencies before they become review comments.

When to use it

  • Reviewing a README or docs file before committing
  • Auditing a docs directory for consistency
  • CI gate for markdown quality
  • Onboarding a new repo and wanting a quick health check

Quick start

# Lint a single file
node /path/to/markdown-lint/scripts/lint.mjs README.md

# Lint a directory (recursive)
node /path/to/markdown-lint/scripts/lint.mjs ./docs/

# JSON output for automation
node /path/to/markdown-lint/scripts/lint.mjs README.md --format json

# Fix safe issues automatically
node /path/to/markdown-lint/scripts/lint.mjs README.md --fix

What it checks

CheckWhat it detects
heading-orderSkipped heading levels (e.g. h1 → h3)
code-langFenced code blocks without a language tag
trailing-wsTrailing whitespace on lines
multiple-h1More than one top-level heading
blank-linesMissing blank lines around headings/lists
link-textBare URLs without link text
list-indentInconsistent list indentation
hr-styleMixed horizontal rule styles

Exit codes

  • 0 — all checks passed
  • 1 — lint errors found
  • 2 — file not found or read error

Output format

Text (default):

README.md
  12:3  error  heading-order    Expected h2, got h3 (skips h2)
  28:1  error  multiple-h1      Multiple H1 headings found
  35:0  warn   trailing-ws      Trailing whitespace

2 errors, 1 warning

JSON:

{
  "file": "README.md",
  "errors": [
    {"line": 12, "col": 3, "rule": "heading-order", "message": "Expected h2, got h3"}
  ],
  "warnings": [
    {"line": 35, "col": 0, "rule": "trailing-ws", "message": "Trailing whitespace"}
  ],
  "summary": {"errors": 1, "warnings": 1}
}

Fixable rules

--fix automatically resolves:

  • trailing-ws — strips trailing whitespace
  • blank-lines — inserts missing blank lines
  • list-indent — normalizes list indentation to 2 spaces

Non-fixable rules (like heading-order, multiple-h1) are reported but not auto-corrected.

Adding custom rules

Create a file rules.json in the same directory as the script:

{
  "maxLineLength": 120,
  "requiredHeadings": ["Installation", "Usage", "License"]
}

The script reads rules.json if present and applies additional checks.

相关技能

Format and lint markdown files for consistency and readability. Use when Codex needs to normalize markdown documents, fix heading levels, standardize link fo...

Scan markdown files and verify that all hyperlinks (both local files and remote URLs) resolve correctly. Use when you need to: (1) verify documentation before publishing, (2) check a repo README or wiki links, (3) audit markdown files for broken links before generating static sites or releasing content, (4) validate links in collected digital assets before archiving.

让 Markdown 在 GitHub、MDX、Pandoc、文档站、Slack、Notion 等解析器中正确渲染,并定位修复具体损坏位置。

296 次安装7 星标

Generate and update table-of-contents (TOC) sections for Markdown files. Use when working with long Markdown documents, READMEs, or technical docs that need a navigable TOC, or when asked to add/update a table of contents in a .md file.

1 次安装

Enforces markdown line-wrap and structure rules for clean git diffs

24 次安装

Scan a directory of Markdown files, extract titles/headings/frontmatter, build a searchable index JSON, and output a concise summary report. Use when you need to inventory, catalog, or make a folder of .md files discoverable without reading each file individually.