--- id: mdformat-ruff version: "0.1.3" license: MIT license_treatment: permissive maintenance: aging --- # mdformat-ruff — Mdformat plugin to ruffen Python code blocks License: permissive · Maintenance: aging · Downloads: 122.0K/mo ## What it is and what it does mdformat-ruff is a plugin for mdformat that applies ruff formatting rules to Python code blocks embedded in Markdown files. When installed, it automatically enables ruff as the code formatter for Python blocks when you run mdformat from the command line, or you can explicitly enable it via the mdformat Python API by passing python to the codeformatters parameter. The plugin depends only on ruff and integrates into mdformat's plugin architecture. It works with Python 3.7 through 3.12 and is commonly used in documentation workflows and pre-commit hooks to ensure Python code examples in Markdown stay consistently formatted. Use it for: - Format Python code examples in project README and documentation files to match your ruff configuration. - Enforce consistent code style in Markdown-based documentation as part of a pre-commit hook workflow. - Automatically convert Python string quotes in code blocks when ruff is configured to do so. - Maintain formatting consistency between Python code blocks in Markdown and the main codebase during CI/CD checks. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Integrates ruff code formatting into mdformat to automatically format Python code blocks within Markdown files. Yes, if you use mdformat for Markdown formatting and want Python code blocks formatted by ruff. Install friction is minimal and the plugin integrates transparently. The aging maintenance status is a minor concern—no recent updates—but the package remains functional and unarchived with no known vulnerabilities. Suitable for documentation workflows where ruff is already your Python formatter. ## Install pip install mdformat-ruff uv add mdformat-ruff poetry add mdformat-ruff ## Installing mdformat-ruff Before you install: Low friction install with a single runtime dependency (ruff). Maintenance status is aging—last release was over a year ago, though the repository remains unarchived. License in practice: MIT license permits unrestricted use, modification, and distribution with minimal obligations. Quickstart: pip install mdformat-ruff import mdformat unformatted = "```python\n'''ruff converts quotes'''\n```\n" formatted = mdformat.text(unformatted, codeformatters={"python"}) assert formatted == '```python\n"""ruff converts quotes"""\n```\n' Verify before relying: - Whether ruff version pinning (e.g., ruff==22.1.0) remains necessary for current versions. - Compatibility with recent mdformat releases and how often updates are planned. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 122.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags markdown python code formatter, mdformat plugin ruff, format python in markdown, markdown code block formatting, ruff markdown integration, markdown-formatting, code-block-linting [View on SkillFed](https://skillfed.io/packages/mdformat-ruff) · [View on PyPI](https://pypi.org/project/mdformat-ruff/)