Skip to main content

Format Python code blocks in Quarto Markdown (.qmd) files using Black

Project description

qmdblack

Format Python code blocks in Quarto Markdown (.qmd) files using Black.

Quarto cell option directives (#| lines) are preserved as-is at the top of each block.

Installation

pip install qmdblack

Usage

# Format files in-place
qmdblack notebook.qmd

# Check without writing (exit 1 if any file would change)
qmdblack --check notebook.qmd

# Show a diff without writing
qmdblack --diff notebook.qmd

# Custom line length (default: 88)
qmdblack -l 100 notebook.qmd

# Multiple files
qmdblack *.qmd

Example

Before:

```{python}
#| echo: false
x=1+2
y   =   x*3
print(   y   )
```

After:

```{python}
#| echo: false
x = 1 + 2
y = x * 3
print(y)
```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qmdblack-0.2.0.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qmdblack-0.2.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file qmdblack-0.2.0.tar.gz.

File metadata

  • Download URL: qmdblack-0.2.0.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for qmdblack-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d55327b66960273b2e9746d2c07a4d2f3a67ae4ae2e6fb7fefb2cca7dfd4f74a
MD5 ee2db56679f2f787b6931109ccfb9699
BLAKE2b-256 4c3af0c2894dd80ccede52f302248bbd1cbd5ed0a1df764645d4da9e3e1b29ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for qmdblack-0.2.0.tar.gz:

Publisher: publish.yml on askblaker/qmdblack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qmdblack-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: qmdblack-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for qmdblack-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d97389659935b4e40f4834bc5c4dd137c1c7e517a9a7e27b2e9cbce9c1f0565
MD5 f89fdc2f0d323962bc2adbcefa1ad4aa
BLAKE2b-256 8d90e4bb35f5df997e85b57c26a7fc2e242e35e542c654176ad612daff12e27f

See more details on using hashes here.

Provenance

The following attestation bundles were made for qmdblack-0.2.0-py3-none-any.whl:

Publisher: publish.yml on askblaker/qmdblack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page