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

hexo-heading-index

v1.0.6

Published

A hexo plugin for adding index to all headings.

Readme

hexo-heading-index

npm version

Automatically adding index to all headings for hexo.

Installation

npm install hexo-heading-index --save

Usage

All you need to do is set the configurations in _config.ymal.

For example. The following config will add indexes like 1.2.3.4. to all headings.

heading_index:
  enable: true
  index_styles: "{1} {1} {1} {1} {1} {1}"
  connector: "."
  global_prefix: ""
  global_suffix: ". "
  start_level: 1
  allow_html: false

Index styles

The indexes are generated in the following format:

<global_prefix><index_for_h1[><connector><index_for_h2><connector>...<index_for_h6>]<global_suffix>

And the format of the indexes for each heading level are defined in the "index_styles" configuration. They are connected by space and its format is:

<prefix>{style[:format:padding]}<suffix>

Index style

And currently we support the following styles:

  • 0: Number index starts from 0
  • 1: Number index starts from 1
  • i: Roman numerals in lowercase
  • I: Roman numerals in uppercase
  • a: Alphabet in lowercase (if the index is greater than 26, then it will be treated as 26, i.e. 'z'.)
  • A: Alphabet in uppercase (if the index is greater than 26, then it will be treated as 26, i.e. 'Z'.)

For example, {1} will create a number index starts from 1. That's why the "index_styles" in the configuration above will create indexes like 1.2.3.4. for all headings.

Formats

We also support a few formats for index styles "0" and "1":

  • x: Output the number in lowercase hex.
  • X: Output the number in uppoercase hex. With this, we can use styles like 0x{0:x:2}, and it will create "0x00" index for the first h1.

Prefix and suffix

Some people prefer to have a '.' or ')' in the end of the indexes or having a '-' or '*' in the begin of the indexes. With prefix and suffix, we can easily do it.

For example:

  • *{i} will give us index like "*vi"
  • {i}) will give us index like "vi)"

And if you would like the prefix and suffix for the whole index, we can specify it in the "global_prefix" and "global_suffix" fields.

For example. The following configuration will help us create indexes like "i.ii.iii.vi) " for the headings.

heading_index:
  enable: true
  index_styles: "{i} {i} {i} {i} {i} {i}"
  connector: "."
  global_prefix: ""
  global_suffix: ") "

Start index

Sometimes, we might want to use other tag than <h1> as the first heading. In this case, we could change the start_level in config or heading_start_level in post.

For example, if we want to use <h2>, then we could change the _config.yml, which will take effect in all posts:

heading_index:
  enable: true
  index_styles: "{1} {1} {1} {1} {1} {1}"
  connector: "."
  global_prefix: ""
  global_suffix: ". "
  start_level: 2

Or change the post config, which will only take effect in the specific post:

---
title: post title
heading_disabled: true
heading_start_level: 2
heading_index_styles: "{A} {i} {1} {1} {1} {1}"
---

License

BSD v3