CLI and pre-commit hook to add hierarchical numbering to Markdown headings.
Project description
markdown-heading-numbering
CLI formatter and pre-commit hook that adds hierarchical numbering to Markdown headings.
Table of Contents:
1. Installation
pip install .
For development:
pip install -e .[dev]
2. CLI Usage
markdown-heading-numbering \
--start-from-level 2 \
--end-at-level 5 \
--initial-numbering 1 \
docs/README.md
Options:
--start-from-level(int, default2): first heading level to number.--end-at-level(int, default6): last heading level to number (inclusive).--initial-numbering(int, default1): starting value for the top-most numbered heading.
Any existing numbering is removed before the formatter applies the new sequence.
3. Pre-commit Hook
This repository ships a .pre-commit-hooks.yaml that points to the CLI. Add
the hook to your .pre-commit-config.yaml:
- repo: https://github.com/jsh9/markdown-heading-numbering
rev: <commit-or-tag>
hooks:
- id: markdown-heading-numbering
args: ["--start-from-level", "2", "--end-at-level", "4"]
The hook shares the same options as the CLI and formats files in place.
4. Tests
pytest
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 markdown_heading_numbering-0.1.0.tar.gz.
File metadata
- Download URL: markdown_heading_numbering-0.1.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
938410fcd76b4f9883e8815509bb70d3719972afde792084e2c8fef1b808d364
|
|
| MD5 |
8f40b1923807448d16b54fc2eae1ce55
|
|
| BLAKE2b-256 |
d7af9b49af8f30e483bbfc5237fd40476973d318ff466630964518fff449f5f3
|
File details
Details for the file markdown_heading_numbering-0.1.0-py3-none-any.whl.
File metadata
- Download URL: markdown_heading_numbering-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4804a0c71acba2029f0a79c31b2b4c6decb07cf4ff0c41771c0a1d0a78cbc199
|
|
| MD5 |
5c77bc6d2c4c634383534200c35ddfc3
|
|
| BLAKE2b-256 |
022f72235e2d255afa3f1045a76d736bc9021086eea7176ab298db52f6df491c
|