Skip to main content

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, default 2): first heading level to number.
  • --end-at-level (int, default 6): last heading level to number (inclusive).
  • --initial-numbering (int, default 1): 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


Download files

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

Source Distribution

markdown_heading_numbering-0.1.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

markdown_heading_numbering-0.1.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file markdown_heading_numbering-0.1.0.tar.gz.

File metadata

File hashes

Hashes for markdown_heading_numbering-0.1.0.tar.gz
Algorithm Hash digest
SHA256 938410fcd76b4f9883e8815509bb70d3719972afde792084e2c8fef1b808d364
MD5 8f40b1923807448d16b54fc2eae1ce55
BLAKE2b-256 d7af9b49af8f30e483bbfc5237fd40476973d318ff466630964518fff449f5f3

See more details on using hashes here.

File details

Details for the file markdown_heading_numbering-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for markdown_heading_numbering-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4804a0c71acba2029f0a79c31b2b4c6decb07cf4ff0c41771c0a1d0a78cbc199
MD5 5c77bc6d2c4c634383534200c35ddfc3
BLAKE2b-256 022f72235e2d255afa3f1045a76d736bc9021086eea7176ab298db52f6df491c

See more details on using hashes here.

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