2.1.3 • Published 4 years ago

docsify-autoheaders v2.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

docsify-autoHeaders

Github2npm npm (tag) GitHub npm bundle size

:sparkles: Demo page :sparkles:


Auto number headings

This plugin is designed to create heading numbers in your pages if you are creating a reference guide.

It stops you from having to manually number the heading, and then have to then trawl through every heading afterwards to change the numbering system again.

It allows you to either have all the headings in one page, or if you split them over many markdown documents then specify what the heading number it should be starting at.

How it works

Installation

Update index.html file

Assuming you have a working docsify framework set up, it is easy to use the plugin.

  1. Add the following script tag to your index.html via either CDN or downloading it and using it locally:

    <!-- unpkg.com -->
    <script src="https://unpkg.com/docsify-autoheaders"></script>
    
    <!-- jsDelivr -->
    <script src="https://cdn.jsdelivr.net/npm/docsify-autoheaders"></script>
    
    <!-- locally -->
    <script src="docsify-autoheaders.js"></script>
  2. In docsify setup configure the plugin:

    <script>
    window.$docsify = {
      autoHeaders: {
        separator: '',    // how numbers should be separated
        levels:    '',    // heading levels h[1-6]
        scope:     '',    // plugin search scope
        debug:     false  // show console.log messages
      },
    };
    </script>

Configuration

There are some options available for the docsify-autoHeaders:

settingoptions
separatorhow you'd like the numbers to be separated. decimal, dash, or bracket
levelsheading levels to target 1-6
scopethe element to narrow it down to. #main is the normal scope
debugtrue or false if you want to see console.log info

Usage

At the top of your file add the following snippet:

@autoHeader:

At the end of the identifier, add the starting number. If you don't have that it won't auto number (good for pages not needing numbering).

You can have a starting header at 0 using:

@autoHeader:0

Example

Input data in file.md

@autoHeader:34

# Black Books

## Season 2

### Episode 1

#### Characters
- Bernard
- Fran

#### Quotes
You! What have you been telling Kate? She thinks I'm
the renaissance. I have to go along with all this
"reclusive genius" stuff... she's going to be very
upset when she finds out I'm a reclusive wanker.

Output data

Example output

Contributing

  1. Clone the repo: git clone https://github.com/markbattistella/docsify-autoHeaders.git

  2. Create your feature branch:

    git checkout -b my-feature

  3. Commit your changes:

    git commit -am 'Add some feature'

  4. Push to the branch:

    git push origin my-new-feature

  5. Submit the pull request

2.1.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.2.5

4 years ago