Skip to content

[CI] Add pre-commit hook markdownlint with basic config#1391

Merged
paulirwin merged 1 commit into
apache:masterfrom
jbampton:add-hook-markdownlint
Jun 24, 2026
Merged

[CI] Add pre-commit hook markdownlint with basic config#1391
paulirwin merged 1 commit into
apache:masterfrom
jbampton:add-hook-markdownlint

Conversation

@jbampton

Copy link
Copy Markdown
Member

Setup very basic config file with a lot of rules disabled.

https://github.com/davidanson/markdownlint#rules--aliases

Uses the Command Line Interface for markdownLint

https://github.com/igorshubovych/markdownlint-cli

Used on Apache Shiro and Airflow:

https://github.com/apache/shiro/blob/638d011a8e90ff500754b4d2f63b0746a2e3c624/.pre-commit-config.yaml#L102

https://github.com/apache/airflow/blob/6877aea6353cd0d54a622a6d7dcb4157888db060/.pre-commit-config.yaml#L1007


Using markdownlint within a pre-commit framework on GitHub prevents poorly formatted or broken documentation from entering your codebase by catching errors locally before code is pushed. It enforces stylistic consistency across files like README.md, turning manual style validation into an automated check.

Key Benefits

  • Enforces Document Consistency: It eliminates conflicting styling choices (like mismatched heading levels or inconsistent indentation) across contributors, producing cohesive documentation.
  • Reduces Code Review Noise: Reviewers can skip nitpicking about markdown formats or spacing in Pull Requests, shifting human focus strictly to content substance and accuracy.
  • Saves CI/CD Build Time: Catching errors locally at the moment of a commit means you do not have to wait for a GitHub Actions workflow to run, fail, and require a fix.
  • Prevents Broken Renderings: It detects parsing inconsistencies before they reach GitHub, ensuring documentation renders beautifully without broken elements on repository homepages.
  • Optimizes Content for AI: Standardised Markdown makes it much easier for AI coding tools and LLMs to correctly ingest, parse, and comprehend your repository's documentation.
  • Automated Error Fixing: When paired with formatting commands, it can automatically fix common layout issues (like missing trailing whitespaces) right during the commit process.

@paulirwin
paulirwin merged commit c5c7942 into apache:master Jun 24, 2026
212 checks passed
@paulirwin paulirwin added the notes:ignore Don't show this PR in the Release Notes label Jun 24, 2026
@jbampton
jbampton deleted the add-hook-markdownlint branch June 26, 2026 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

notes:ignore Don't show this PR in the Release Notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants