mdformat-black
Mdformat plugin to Blacken Python code blocks
Decision gist · record as of 2026-08-14
Yes, if you use mdformat and want Python code blocks in your Markdown to follow Black's style. The low install friction, permissive license, and lack of known vulnerabilities make it straightforward. However, the aging maintenance status (last release 2020-09-24) means you should verify compatibility with your current Black and mdformat versions before relying on it in production workflows.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires mdformat and black to be installed; Python >=3.6,<4.0
- Low install friction with just two runtime dependencies.
- The package is aging—last release was 2020-09-24 and last commit 2025-03-09—but remains unarchived.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use, modify, and distribute freely with minimal restrictions.
last release 2020-09-24 (2150 days) · last repo commit 2025-03-09 · 9 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 114,372 downloads/mo, #12,299 on PyPI
Alternatives
Verify before relying
pip install mdformat-black
import mdformat
unformatted = "```python\n'''black converts quotes'''\n```\n"
formatted = mdformat.text(unformatted, codeformatters={"python"})
assert formatted == '```python\n"""black converts quotes"""\n```\n'- Whether the package works reliably with recent versions of black and mdformat beyond classifier claims.
- Whether there are known incompatibilities with Python 3.9+ despite the 'supports_current' designation.
What it is and what it does
mdformat-black is a plugin that extends mdformat to apply Black's Python code formatting rules to Python code blocks within Markdown files. When installed, mdformat automatically recognizes and formats Python code blocks using Black's conventions—converting quote styles, enforcing line length, and applying other Black rules—while leaving the rest of your Markdown untouched.
The plugin works both from the command line (automatically after install) and programmatically via mdformat's Python API (where you must explicitly enable it by passing `codeformatters={"python"}` to mdformat.text()). It requires Python >=3.6,<4.0 and depends on mdformat and black as runtime dependencies.
Use it for
- Automatically format Python code examples in technical documentation to match your project's Black style.
- Ensure consistency between code snippets in README files and your actual codebase formatting.
- Integrate Python code block formatting into a Markdown linting or CI pipeline alongside mdformat.
- Format Python code blocks in blog posts or tutorials written in Markdown without manual editing.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you use mdformat and want Python code blocks in your Markdown to follow Black's style.
The low install friction, permissive license, and lack of known vulnerabilities make it straightforward. However, the aging maintenance status (last release 2020-09-24) means you should verify compatibility with your current Black and mdformat versions before relying on it in production workflows.
Install
mdformat-black on PyPI
Before you install
Low install friction with just two runtime dependencies. The package is aging—last release was 2020-09-24 and last commit 2025-03-09—but remains unarchived.
Requires mdformat and black to be installed; Python >=3.6,<4.0
License in practice
MIT license is permissive; you can use, modify, and distribute freely with minimal restrictions.
Quickstart
pip install mdformat-black
import mdformat
unformatted = "```python\n'''black converts quotes'''\n```\n"
formatted = mdformat.text(unformatted, codeformatters={"python"})
assert formatted == '```python\n"""black converts quotes"""\n```\n'
Verify before relying
- Whether the package works reliably with recent versions of black and mdformat beyond classifier claims.
- Whether there are known incompatibilities with Python 3.9+ despite the 'supports_current' designation.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.6,<4.0 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagesmdformatblack |
| Maintenance | Aging 2,150 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 114,372 / month, #12,299 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Topic :: DocumentationTopic :: Text Processing :: MarkupTyping :: Typed |
Evidence: mdformat_black-0.1.1-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 › “mdformat black plugin”
- mdformat-blackA plugin for mdformat that automatically formats Python code blocks…
- mdformat-footnoteAdds footnote parsing and formatting support to mdformat, enabling…
- mdformat_deflistExtends mdformat with support for parsing and formatting definition…
Give your agent the search over MCP, or paste the wish link into any chat.
More Markup packages
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.
A Python markdown parser that converts markdown to HTML following the CommonMark specification, with support for plugins and custom syntax rules.
Install it if you need reliable markdown-to-HTML conversion.
Beautiful Soup parses HTML and XML documents into a navigable tree, providing Pythonic methods to search, iterate, and modify the parsed content.
Install it if you need to parse or extract data from markup documents.
et_xmlfile writes large XML files with minimal memory overhead by serializing elements to disk as they are created, rather than holding the entire tree in memory.
Install it if incremental XML writing fits your use case; skip it if your XML documents are small or you already use lxml.
Parses and edits TOML files while preserving formatting, comments, and structure, then serializes them back with layout intact.
Install it if you're building tools that touch TOML files and user readability of the source matters.
Parses Python docstrings in ReST, Google, Numpydoc, and Epydoc formats, extracting structured information like descriptions, parameters, return types, and exceptions.
Install it if you need to programmatically read and extract structured data from Python docstrings.
See also mdformat-ruff · pyink · mdformat-toc · mdformat_myst · mdformat · black · blacken-docs · mdformat-gfm-alerts · mdformat_tables · mdformat-mkdocs