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.
Installation
pip install md-snakeoil
Command Line Interface
The package provides a command-line interface (CLI) using typer.
The CLI has two main commands:
file: Formats and lints Python code blocks in a single Markdown file.directory: Recursively formats and lints Python code blocks in all Markdown files within a directory.
Usage
Help
snakeoil --help
Usage: snakeoil [OPTIONS] COMMAND [ARGS]...
Format and lint Python code blocks in Markdown files.
╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --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. │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ file Process a single Markdown. │
│ directory Format all Markdown files within a directory (recursively!). │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
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.
You can pull up the help page for individual commands:
snakeoil file --help
snakeoil directory --help
Single Markdown
snakeoil file path/to/file.md
Formatting all files in a directory
snakeoil directory 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.2.tar.gz.
File metadata
- Download URL: md_snakeoil-0.1.2.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.5.0-1025-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a19088b1ee4fca10105e388142f7327e6c859bd24996df6d12701a404edc63f5
|
|
| MD5 |
dcf2700cc8faa70b959c12b12ed7a2a0
|
|
| BLAKE2b-256 |
7a3e33b50d1db3f10bd31470b391412f175144bbebf10f1892493996e49e1b07
|
File details
Details for the file md_snakeoil-0.1.2-py3-none-any.whl.
File metadata
- Download URL: md_snakeoil-0.1.2-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.5.0-1025-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06aa1441e064ba8e30a7ed99e2125ae96fc45686701f4805689c62d1ca4e3fe9
|
|
| MD5 |
178ead30a5c886b40bea39ad2bc0aed2
|
|
| BLAKE2b-256 |
da66a71ddd3f4a10f31f9200c6ec2d89b95983a2fa193838ca890ebb08f198a7
|