Format and lint Python code blocks within markdown files.
Project description
A Python package/CLI to format and lint Python code blocks within Markdown
files.
Specifically designed for Markdown files used with
mkdocs-material.
md-snakeoil is built on the awesome ruff
formatter and linter and helps you to keep your Markdown files looking
sharp. ๐ค๐ฝ
before vs. after
Quickstart
Use pipx:
pipx install md-snakeoil
Format and lint Markdown files within a directory (recursively):
snakeoil path/to/directory
That's it! ๐
[!NOTE] If, your using
uv, install it withuv tool install md-snakeoil
Command Line Interface
The package provides a command-line interface (CLI) using typer.
Help
snakeoil --help
Usage: snakeoil [OPTIONS] [PATH] COMMAND [ARGS]...
Format and lint Python code blocks in Markdown files.
โญโ Arguments โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ path [PATH] File or directory to format [default: None] โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ Options โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ --line-length INTEGER Maximum line length for the formatted code [default: 79] โ
โ --rules TEXT Ruff rules to apply (comma-separated) [default: I,W] โ
โ --install-completion Install completion for the current shell. โ
โ --show-completion Show completion for the current shell, to copy it or customize the installation. โ
โ --help Show this message and exit. โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
By default, the line length is set to 79 characters, and the Ruff rules W and
I are enabled. You can change these defaults using the --line-length and
--rules options.
Single Markdown
snakeoil path/to/file.md
Formatting all files in a directory
snakeoil path/to/directory
This will recursively format and lint the Python code blocks in all Markdown
files within path/to/directory.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file md_snakeoil-0.1.5.tar.gz.
File metadata
- Download URL: md_snakeoil-0.1.5.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7e253ddea3a35137cb576778ba0c91fc384e1ab658f03bd6cf08095f4255dac
|
|
| MD5 |
c7f455299e3333e0d9cab6ba30ff7b76
|
|
| BLAKE2b-256 |
b205b98b2ac7139061a0732353de7940025426e9e10639de5b0e56b9f07428e3
|
Provenance
The following attestation bundles were made for md_snakeoil-0.1.5.tar.gz:
Publisher:
publish.yml on mciwing/md-snakeoil
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
md_snakeoil-0.1.5.tar.gz -
Subject digest:
b7e253ddea3a35137cb576778ba0c91fc384e1ab658f03bd6cf08095f4255dac - Sigstore transparency entry: 178539851
- Sigstore integration time:
-
Permalink:
mciwing/md-snakeoil@2fd233cb3ce194e37ca40685750aa41f6e76a6d3 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mciwing
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2fd233cb3ce194e37ca40685750aa41f6e76a6d3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file md_snakeoil-0.1.5-py3-none-any.whl.
File metadata
- Download URL: md_snakeoil-0.1.5-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
497fc8574129c4204d6cbd75c0ecfb96c7c41b34f72ffbdd8140ed3735eb9308
|
|
| MD5 |
536fc5bf65dc6d989205fb2bb4c49c2e
|
|
| BLAKE2b-256 |
a43b3cad8fba92a80f2f7c60f0b243842e28cab0f3b3496b5aee9cef51dfd708
|
Provenance
The following attestation bundles were made for md_snakeoil-0.1.5-py3-none-any.whl:
Publisher:
publish.yml on mciwing/md-snakeoil
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
md_snakeoil-0.1.5-py3-none-any.whl -
Subject digest:
497fc8574129c4204d6cbd75c0ecfb96c7c41b34f72ffbdd8140ed3735eb9308 - Sigstore transparency entry: 178539853
- Sigstore integration time:
-
Permalink:
mciwing/md-snakeoil@2fd233cb3ce194e37ca40685750aa41f6e76a6d3 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mciwing
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2fd233cb3ce194e37ca40685750aa41f6e76a6d3 -
Trigger Event:
push
-
Statement type: