markdown-lint

Validates and fixes Markdown files against markdownlint rules in pre-commit and CI workflows.

14|5|Updated Mar 30, 2026
One-click install
npx skills add https://github.com/Ascend/MindIE-SD --skill markdown-lint-ascend
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: markdown-lint
Source: https://github.com/Ascend/MindIE-SD/tree/main/.agents/skills/markdown-lint
Command: npx skills add https://github.com/Ascend/MindIE-SD --skill markdown-lint-ascend

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires markdownlint-cli, pre-commit.

What problem does it solve? Markdown files in the MindIE-SD repository frequently fail CI gates due to markdownlint violations such as MD040 (fenced code blocks missing a language), and bulk fixes risk corrupting UTF-8 Chinese content when edited with PowerShell. This Skill consolidates the repository's lint rules, verification commands, and safe repair patterns so violations are fixed correctly the first time. ## Core Features & Use Cases - Rule Reference: Documents key markdownlint rules (MD040, MD009, MD012, MD031, MD032, MD047) with correct and incorrect examples, plus a language-selection guide for fenced code blocks (python, shell, text, yaml, json, markdown). - Verification Commands: Explains the dual-hook pre-commit setup (markdownlint-manual requiring --hook-stage manual, markdownlint-agents running by default on .agents/) and provides commands for full-repo and commit-scoped checks using .markdownlint.json. - Safe Batch Fixing: Provides encoding-safe repair workflows using Python or Node.js instead of PowerShell, covering both top-level and indented code fence variants, with post-fix validation steps. - Use Case: When CI reports MD040 violations across dozens of README files, use this Skill to add language identifiers to all fenced code blocks, handle indented variants, and re-run markdownlint to confirm zero violations without breaking Chinese characters. ## Quick Start Ask the AI to fix the markdownlint violations in your changed Markdown files and verify them with the repository's .markdownlint.json configuration.

Frequently Asked Questions about markdown-lint

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix MD040 fenced code block language violations?

Add a language identifier to every fenced code block, using python, shell, text, yaml, json, or markdown based on content type. Cover both top-level and indented fence variants, then re-run markdownlint with the repository config to confirm zero violations.

How do I run markdownlint on only changed Markdown files?

Use git diff --name-only HEAD~1..HEAD -- '*.md' piped to xargs markdownlint -c .markdownlint.json for commit-scoped checks. For single files, run pre-commit with the markdownlint-manual hook, --hook-stage manual, and --files.

Why does pre-commit run --all-files skip markdownlint checks?

The markdownlint-manual hook is configured with stages: [manual], so it is silently skipped unless you pass --hook-stage manual. Files under .agents/ are covered separately by the markdownlint-agents hook, which runs on the default pre-commit stage.

How do I batch edit Markdown files with Chinese text without breaking encoding?

Use Python open() with encoding='utf-8' or Node.js fs.readFileSync/writeFileSync with 'utf-8'. Avoid PowerShell Get-Content and Set-Content, which inject BOMs and corrupt UTF-8 Chinese characters; verify with git diff afterward.

Which markdownlint version should I use for this repository?

Use the pinned markdownlint-cli v0.44.0. Newer versions such as 0.49.x report thousands of false MD060 violations on the same files, while 0.44.0 reports zero, so version alignment with the pre-commit configuration is required.