Skip to main content

MkDocs plugin to add hierarchical numbering to nav and page headings

Project description

mkdocs-nav-numbering-plugin

CI PyPI

MkDocs plugin that adds hierarchical numbering to navigation items and page headings.

Features

  • Number nav sections, pages, and links (optional)
  • Number page headings based on nav position
  • Configurable depth limits for nav and headings
  • Configurable separator
  • Exclude specific pages

image

Installation

pip install mkdocs-nav-numbering-plugin

Usage

plugins:
  - nav-numbering:
      nav_depth: 4
      heading_depth: 5
      number_h1: true
      number_nav: true
      number_headings: true
      preserve_anchor_ids: false
      separator: "."
      exclude:
        - index.md

markdown_extensions:
  - attr_list  # Required when preserve_anchor_ids is true

Options

  • enabled (bool, default: true)
  • nav_depth (int, default: 0) — 0 means unlimited
  • heading_depth (int, default: 0) — 0 means unlimited
  • number_nav (bool, default: true)
  • number_headings (bool, default: true)
  • number_h1 (bool, default: true)
  • preserve_anchor_ids (bool, default: false) — Preserve original heading anchor IDs without number prefixes (requires attr_list)
  • separator (str, default: ".")
  • exclude (list, default: [])

preserve_anchor_ids

By default, MkDocs generates heading IDs from the final heading text. Since this plugin prepends numbering, your anchors can end up including the numbers.

Enable preserve_anchor_ids: true to add explicit {#...} IDs based on the original (un-numbered) heading text. Duplicate headings are automatically suffixed with -1, -2, etc.

plugins:
  - nav-numbering:
      preserve_anchor_ids: true

markdown_extensions:
  - attr_list

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

mkdocs_nav_numbering_plugin-1.2.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

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

mkdocs_nav_numbering_plugin-1.2.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs_nav_numbering_plugin-1.2.0.tar.gz.

File metadata

File hashes

Hashes for mkdocs_nav_numbering_plugin-1.2.0.tar.gz
Algorithm Hash digest
SHA256 28ea9e3423112142c72af0c45839258aa27610816db611cf354529f4e9fcf46e
MD5 30fa734b311ca92cf6df0daa5ab9ee3f
BLAKE2b-256 0b895fff53f9a2822f17c2ab712c8df1da410d47adb5f8d1cd799bf37f04fd2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for mkdocs_nav_numbering_plugin-1.2.0.tar.gz:

Publisher: publish.yml on matusdrobuliak66/mkdocs-nav-numbering-plugin

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mkdocs_nav_numbering_plugin-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocs_nav_numbering_plugin-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 35b764685e4336a113c5cef34bd6553520cd962f7a0f42246d50d0270ec04eb4
MD5 eaf9247c941030d9b4d7826d5f6e89e9
BLAKE2b-256 f0a8833bcd88a649553ff29962aacefcd37d821f10714358f1134e08cde9d5b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for mkdocs_nav_numbering_plugin-1.2.0-py3-none-any.whl:

Publisher: publish.yml on matusdrobuliak66/mkdocs-nav-numbering-plugin

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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