mdformat
CommonMark compliant Markdown formatter
Decision gist · record as of 2026-08-14
Yes. Mdformat is actively maintained, has minimal dependencies, supports current Python versions, carries no known vulnerabilities, and is MIT-licensed. It is well-suited for projects that need CommonMark-compliant Markdown formatting in CI/CD or as a pre-commit hook. Install it if you want a lightweight, pure-Python formatter; consider its plugin ecosystem if you need support for non-CommonMark dialects.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- The --exclude option is only available on Python 3.13+.
- Low install friction with only two runtime dependencies (markdown-it-py and tomli).
License · maintenance · safety
MIT (permissive) — MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
last release 2025-10-16 (302 days) · last repo commit 2026-08-10 · 810 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 2,899,273 downloads/mo, #2,830 on PyPI
Alternatives
Verify before relying
pip install mdformat
mdformat README.md
# Or check without modifying:
mdformat --check README.md
# Or use as a library:
from mdformat import text
formatted = text("# Hello\n\nWorld")- Whether the package's plugin ecosystem (mdformat-gfm, mdformat-myst, etc.) is actively maintained and widely adopted.
- Performance characteristics when formatting large Markdown files or directories with thousands of files.
- How well the formatter handles edge cases in real-world Markdown that mixes CommonMark with custom syntax.
What it is and what it does
Mdformat is a pure-Python Markdown formatter built on the markdown-it parser that enforces CommonMark compliance across your Markdown files. It works as both a standalone command-line tool and a Python library, making it suitable for CI/CD pipelines, pre-commit hooks, and programmatic use. The formatter is opinionated about style—it normalizes formatting to a single canonical form—and validates that its changes don't alter the rendered HTML output.
The tool supports extensibility through plugins for non-CommonMark dialects like GitHub Flavored Markdown, MyST, and others. It can format files in place, check formatting without modifying files, and read from stdin. Unlike Node.js-based alternatives, mdformat requires no additional runtime beyond Python itself, making it lightweight for Docker images and environments where Python is already available.
Use it for
- Enforce consistent Markdown style across a documentation repository as part of CI/CD or pre-commit hooks.
- Format Markdown files in bulk before committing to version control to maintain a uniform code style.
- Validate that Markdown files conform to CommonMark specification without altering their rendered meaning.
- Integrate Markdown formatting into Python-based documentation generation or build pipelines.
- Check Markdown formatting in pull requests without applying changes, using the --check flag.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Mdformat is actively maintained, has minimal dependencies, supports current Python versions, carries no known vulnerabilities, and is MIT-licensed. It is well-suited for projects that need CommonMark-compliant Markdown formatting in CI/CD or as a pre-commit hook. Install it if you want a lightweight, pure-Python formatter; consider its plugin ecosystem if you need support for non-CommonMark dialects.
Install
mdformat on PyPI
Before you install
Low install friction with only two runtime dependencies (markdown-it-py and tomli). The project is actively maintained with a recent commit on 2026-08-10 and supports current Python versions (requires Python 3.10+).
Requires Python 3.10 or later. The --exclude option is only available on Python 3.13+.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
Quickstart
pip install mdformat
mdformat README.md
# Or check without modifying:
mdformat --check README.md
# Or use as a library:
from mdformat import text
formatted = text("# Hello\n\nWorld")
Verify before relying
- Whether the package's plugin ecosystem (mdformat-gfm, mdformat-myst, etc.) is actively maintained and widely adopted.
- Performance characteristics when formatting large Markdown files or directories with thousands of files.
- How well the formatter handles edge cases in real-world Markdown that mixes CommonMark with custom syntax.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagesmarkdown-it-pytomli |
| Maintenance | Actively maintained 302 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,899,273 / month, #2,830 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Environment :: ConsoleOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxTopic :: DocumentationTopic :: Software Development :: Libraries :: Python ModulesTopic :: Text Processing :: MarkupTyping :: Typed |
Evidence: mdformat-1.0.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “markdown formatter commonmark”
- mdformatMdformat is a CommonMark-compliant command-line Markdown formatter…
- mdformat_mystmdformat-myst is an mdformat plugin that extends Markdown formatting…
- mdformat-gfmMdformat-gfm extends mdformat to format GitHub Flavored Markdown,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also mdformat-gfm · mdformat_myst · mdurl · mdformat-toc · mdformat-ruff · mdformat-mkdocs · mdformat-gfm-alerts · mdformat_tables · mdformat-black · mdformat-footnote