Skip to main content

MkDocs plugin to add hierarchical numbering to nav and page headings

Project description

mkdocs-nav-numbering-plugin

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

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.1.0.tar.gz (6.3 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.1.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for mkdocs_nav_numbering_plugin-1.1.0.tar.gz
Algorithm Hash digest
SHA256 e9ab84f84e3dd9f8e9ace174316bbcb676f2568d80d101071c265b1c387c8815
MD5 8f28401455579c73a2c1c4b2ea5ae458
BLAKE2b-256 0e7c750838650a84871d6b4ed0c0f8e375b6e057dbd638262a4f32a729942000

See more details on using hashes here.

Provenance

The following attestation bundles were made for mkdocs_nav_numbering_plugin-1.1.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.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocs_nav_numbering_plugin-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 212a476c056e13d8ec1e842edd6c4a8b29d449b0bc8e6725d893951572df2243
MD5 a98dac5760f90c38c6dab69d31eb06be
BLAKE2b-256 3cf7844dc87ef6c3cc359b20bc8091dd9f6155088cb53e16e932760787df5163

See more details on using hashes here.

Provenance

The following attestation bundles were made for mkdocs_nav_numbering_plugin-1.1.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