npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

markdownlint-rule-numbered-headings-unique

v1.2.0

Published

A markdownlint rule that requires that headings ending in numbers are uniquely numbered

Readme

markdownlint-rule-numbered-headings-unique

A custom markdownlint rule that checks that headings ending in a number are unique within the document.

It is best used with MD024 set to "siblings-only". It will work with any setting, but with global uniqueness in MD024 both rules will trigger if a heading ends in a number.

Overview

This rule is for the Node.js markdownlint library and its associated tools. It enforces that any heading ending in a number (e.g., ## 1, ## Test 42) must be unique across the entire Markdown document. Headings after the ones above need to be, for example, ## 2 and ### Test 101.

Auto-fix / Quick Fix

This rule supports auto-fixing duplicate numbered headings:

  • In VS Code, you can use the Quick Fix feature (lightbulb or right-click) to automatically update duplicate numbered headings to the next available number.
  • On the command line, you can use markdownlint's --fix option to apply the same fix automatically.

The auto-fix will change any duplicate number to a value higher than any existing in the document. For example, if ## 2 is duplicated, the fix will update the duplicate to ## 3 (or the next available number).

The changelog in this document is an example where only one heading of each version is allowed.

Why?

The built-in markdownlint rule MD024 can require all headings to be globally unique (which is often too strict) or only check siblings (which can be too permissive). This rule provides a middle ground: only headings ending in a number must be unique, which is useful for structured documents like release notes or test case lists.

Examples of where this is useful:

  • Release notes. There should not be two headings with the same version number.
  • Test case documents. Each test case should have a unique number. They are not necessarily increasing in the document and new numbers should not re-use old numbers. The auto-fix/Quick Fix will allocate numbers higher than the existing.

Installation

npm install --save-dev markdownlint-rule-numbered-headings-unique

Usage

With markdownlint-cli

If installed locally, markdownlint will auto-discover the rule by package name. You can use:

markdownlint --rules markdownlint-rule-numbered-headings-unique *.md

If you want to use a direct path, you can still use:

markdownlint --rules ./index.cjs *.md

With markdownlint-cli2

If installed locally, markdownlint-cli2 will auto-discover the rule by package name. You can add it to your config file using the package name:

{
    "customRules": [
        "markdownlint-rule-numbered-headings-unique"
    ]
}

Or to .markdownlint-cli2.yaml:

customRules:
    - markdownlint-rule-numbered-headings-unique

To use a direct path, you can still reference index.cjs if needed:

{
    "customRules": [
        "./index.cjs"
    ]
}

With VS Code

If using the markdownlint extension for VS Code, install this package in your workspace and the rule will be auto-discovered. For advanced usage, see the markdownlint-cli2 examples above or refer to the extension documentation.

Testing

To run the tests:

npm test

Contributing

Pull requests and issues are welcome! Please ensure your code passes linting and tests before submitting.

Changelog

1.2.0

New Features

The numbered headings keeps the number of digits in a heading by padding with leading zeros.

1.1.0

New Features

Quick fix added that changes any duplicates to one above the current max number in the document. When fixing all errors the duplicates get increasing numbers.

1.0.9

New Features

First automatically published version.

License

MIT