Format and lint Python code blocks within Markdown files. Usable as CLI,
pre-commit hook or Python package.
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
With uv install
it as a tool:
uv tool install md-snakeoil
Format and lint Markdown files within a directory (recursively):
snakeoil path/to/directory
That's it! 🚀
pre-commit hook
To run md-snakeoil with pre-commit add following to your
.pre-commit-config.yaml:
repos:
- repo: https://github.com/JakobKlotz/md-snakeoil
rev: v0.1.9
hooks:
- id: snakeoil
Command Line Interface
The package provides a command-line interface (CLI) using typer.
Help
snakeoil --help
Usage: snakeoil [OPTIONS] [PATH]
Format & lint Markdown files. Either a single file or all files in a directory,
╭─ Arguments ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ path [PATH] File or directory to process │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --line-length INTEGER Maximum line length for the formatted code [default: 79] │
│ --rules TEXT Ruff rules to apply (comma-separated) [default: I,W] │
│ --check --no-check Check if files would be reformatted without writing changes [default: no-check] │
│ --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.
For example, format the example files within the tests/ directory
(of this repository):
> snakeoil tests/examples
Formatted: tests\examples\indentation.md
Formatted: tests\examples\info_strings.md
Formatted: tests\examples\test.md
3 formatted, 0 already formatted.
Metadata
Release files for md-snakeoil 0.1.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| md_snakeoil-0.1.9.tar.gz | 5.1 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| md_snakeoil-0.1.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.6 kB
Release files / md_snakeoil-0.1.9.tar.gz
| Download URL | md_snakeoil-0.1.9.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d6a84ae77737ca73498efe7a1e5408175e4d3b201c671f7402a89fe128f62fa
|
|
BLAKE2b-256 checksum How to use checksums |
ed4be3fb4460acd3d68fba8f195d27bd968e719de33c336a0186b39e3e5ce9ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 22, 2026.
Transparency logRelease files / md_snakeoil-0.1.9-py3-none-any.whl
| Download URL | md_snakeoil-0.1.9-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
83fe9c9ed9700b63baf82d283562984daf9fd34c6816a3a49f8995f53c9c12ff
|
|
BLAKE2b-256 checksum How to use checksums |
920a502b65d788bee932113c12f6adb569d3bfbe4c6cbcd6eb78c9206f039ae6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 22, 2026.
Transparency logSecurity for md-snakeoil 0.1.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for md_snakeoil-0.1.9.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 22, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.