Skip to main content

mdformat-ruff

pre-commit.ci status github/workflow

github/downloads github/downloads/latest github/issues github/issues-closed github/issues-pr github/issues-pr-closed github/discussions github/milestones github/forks github/stars github/watchers github/contributors github/commit-activity github/last-commit github/release-date

github/license github/languages github/languages/top github/directory-file-count github/code-size github/repo-size github/v

pypi/status pypi/v pypi/downloads pypi/format pypi/implementation pypi/pyversions

Mdformat plugin to ruffen Python code blocks

Description

mdformat-ruff is an mdformat plugin that makes mdformat format Python code blocks with ruff.

Usage

Install with:

pip install mdformat-ruff

You may pin ruff dependency for formatting stability:

pip install mdformat-ruff ruff==22.1.0

When using mdformat on the command line, ruff formatting will be automatically enabled after install.

When using mdformat Python API, code formatting for Python will have to be enabled explicitly:

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'

Usage as a pre-commit hook

Add the following to your .pre-commit-config.yaml:

  - repo: https://github.com/executablebooks/mdformat
    rev: 0.7.13 # Use the ref you want to point at
    hooks:
      - id: mdformat
        additional_dependencies:
          - mdformat-ruff
          - ruff==22.1.0 # Pinning ruff here is optional

Metadata

Release files for mdformat-ruff 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mdformat-ruff 0.1.3
File Size Uploaded
mdformat_ruff-0.1.3.tar.gz 3.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mdformat-ruff 0.1.3
File Interpreter ABI Platform
mdformat_ruff-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 7.3 kB

Release files / mdformat_ruff-0.1.3.tar.gz

Download URL mdformat_ruff-0.1.3.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2ddd2758dd3f6738c1c7bfbeb89320d271454f4cd8c28a99968a50d3578b15d6
BLAKE2b-256 checksum
How to use checksums
3ae29003dc57c78aea34b21f67854d842985ceac48028d288432efa113df3887
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / mdformat_ruff-0.1.3-py3-none-any.whl

Download URL mdformat_ruff-0.1.3-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c0cf7bfe6bf99b9e0e617e960041d06e9fa84300d5645f922306dd2ed0d1296
BLAKE2b-256 checksum
How to use checksums
b1223f2464d478f145bbcb731cee9fe720b9e4d69efb6ffd8bc4491f14ca20a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page