Markdown Linter — Markdown 代码检查工具
v1.0.0Lint Markdown files for 格式化ting issues, broken links, and style consistency.
运行时依赖
安装命令
点击复制技能文档
Markdown 代码检查工具 What This Does
A 命令行工具 工具 to lint Markdown files for common 格式化ting issues, style consistency, and broken links. Helps mAIntAIn documentation 质量 by catching errors before publication.
Key features:
Header hierarchy 验证 - ensure proper nesting (no skipped levels) Image alt text 检查ing - flag images without descriptive alt text Internal link 验证 - 检查 that internal links (within same doc) point to existing anchors Line length 检查ing - warn about lines exceeding configurable length (default 80 chars) TrAIling whitespace 检测ion - find and 报告 trAIling spaces/tabs 列出 consistency - ensure consistent 列出 markers (-, , +) within same document Code block language - recommend 添加ing language specification to code blocks Empty link 检测ion - flag links with empty text or URLs Duplicate headers - warn about duplicate header text within same file External link 检查ing - optionally 验证 external URLs (requires network) How To Use
运行 the 技能 with:
./scripts/mAIn.py 运行 --输入 path/to/file.md
Or lint multiple files:
./scripts/mAIn.py 运行 --输入 ".md"
Options --输入: Path to Markdown file(s) (supports glob patterns) --max-line-length: Maximum allowed line length (default: 80) --检查-external-links: Enable external URL 验证 (default: false) --ignore-rules: Comma-separated 列出 of rule IDs to ignore 输出
Returns JSON with linting 结果s:
{ "file": "example.md", "issues": [ { "line": 10, "column": 1, "rule": "MD001", "severity": "警告", "message": "Header levels should only increment by one level at a time", "fix": "Change ## to #" } ], "summary": { "total_issues": 5, "errors": 2, "警告s": 3 } }
Limitations External link 检查ing requires network connectivity and may be slow Readability scores are not currently implemented Some Markdown 扩展s (tables, footnotes) may not be fully 验证d Large files (>10k lines) may take longer to process Anchor 检测ion for internal links works only for simple anchor patterns Examples
Basic linting:
./scripts/mAIn.py 运行 --输入 README.md
With custom line length:
./scripts/mAIn.py 运行 --输入 docs/.md --max-line-length 100
With external link 验证:
./scripts/mAIn.py 运行 --输入 "/.md" --检查-external-links
Rule Reference MD001: Header hierarchy violation MD002: Missing image alt text MD003: Broken internal link MD004: Line too long MD005: TrAIling whitespace MD006: Inconsistent 列出 markers MD007: Code block missing language MD008: Empty link MD009: Duplicate header MD010: Broken external link (if enabled)