Skip to main content

docums-enumerate-headings-plugin

Docums Plugin to enumerate the headings (h1-h6) across Docums pages.

👉 If you're looking to add heading numbers to your site to support exporting to single-page standalone HTML or a PDF file, have a look at docums-print-site-plugin instead!

Features 🌟

  • Automatically number all headings and (optionally) give each page an sequential chapter number
  • Great for writing (technical) reports
  • Compatible with plugins like awesome-pages and monorepo
  • Compatible with markdown_extensions like pymdownx.snippets
  • Compatible with themes like docurial
  • Easy to customize styling through CSS

Setup

Install the plugin using pip:

pip3 install docums-enumerate-headings-plugin

Next, add the following lines to your docums.yml:

plugins:
  - search
  - enumerate-headings

Docums executes plugins in the order they are defined. If you use any other plugins that alter the navigation, make sure to define them before the enumerate-headings plugin.

If you have no plugins entry in your config file yet, you'll likely also want to add the search plugin. Docums enables it by default if there is no plugins entry set.

Usage

enumerate-headings will increment the chapter number for each new page (in the order they appear in the navigation) and enumerate all subheadings (unless you disable in this in the options).

There is only one requirement: make sure each markdown page starts with a level 1 header (see how to write markdown headers). Some Docums themes will handle this for your automatically, inserting the page title as a heading 1 if you do not specify one. If a heading 1 is still missing, you'll get a helpful error.

Pages with multiple level 1 headings are allowed and the chapter numbers will increment accordingly.

Note this plugin does not affect your markdown files, only the rendered HTML.

Styling

All heading numbers are wrapped in <span class='enumerate-headings-plugins'></span> and can be styled using CSS. See customizing a Docums theme on how to add an CSS to your theme.

As an example you can make the numbering lighter than the heading title by saving the CSS snippet below to a file and adding it to your Docums site using the extra_css setting in your docums.yml file.

/* Extra CSS for docums-enumerate-headings-plugin */ 
.enumerate-headings-plugin {
  filter: opacity(35%);
}

Options

You can customize the plugin by setting options in docums.yml:

plugins:
    - enumerate-headings:
        toc_depth: 0
        strict: true
        increment_across_pages: true
        exclude:
          - index.md
          - another_page.md
  • toc_depth (default 0): Up to which level the table of contents should be enumerated as well. Default is 0, which means the TOC is not enumerated at all. Max is 6 (showing all enumeration)
  • strict (default true): Raise errors instead of warnings when first heading on a page is not a level one heading (single #) and your Docums theme has not inserted the page title as a heading 1 for you. Note that in strict: false mode the heading numbers might be incorrect between pages and before and after a level 1 heading.
  • increment_across_pages (default true): Increment the chapter number for each new page (in the order they appear in the navigation). If disabled, each page will start from 1.
  • exclude (default not specified): Specify a list of page source paths (one per line) that should not have enumeration (excluded from processing by this plugin). This can be useful for example to remove enumeration from the front page. The source path of a page is relative to your docs/ folder. You can also use globs instead of source paths. For example, to exclude docs/subfolder/page.md specify in your docums.yml a line under exclude: with - subfolder/page.md

Metadata

Release files for docums-enumerate-headings-plugin 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for docums-enumerate-headings-plugin 0.5.0
File Size Uploaded Provenance
docums-enumerate-headings-plugin-0.5.0.tar.gz 7.9 kB Without provenance Details

Release files / docums-enumerate-headings-plugin-0.5.0.tar.gz

Download URL docums-enumerate-headings-plugin-0.5.0.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6662ace41eb148fe9dfbd7df6a20d5c56e2ce8616e766f27cb2b40059f442532
BLAKE2b-256 checksum
How to use checksums
a525a74d4cfbe70f1ed91ec8762dc5542b0bf376a9d43218a2162f0d04ab19bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.4

Security for docums-enumerate-headings-plugin 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page