Skip to content

aborazmeh/textlint-rule-header-levels

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

textlint-rule-header-levels Actions Status: test textlint rule

Specify the least and most allowed header levels

Install

Install with npm:

npm install textlint-rule-header-levels

Example

If the minimum header level was set to 2, this will yield an error:

# Title
## Subtitle

Usage

Via .textlintrc.json(Recommended)

{
    "rules": {
        "header-levels": {
            "min_header_level": 1,
            "max_header_level": 6
        }
    }
}

Via CLI

textlint --rule header-levels README.md

Build

Builds source codes for publish to the lib folder. You can write ES2015+ source codes in src/ folder.

npm run build

Tests

Run test code in test folder. Test textlint rule by textlint-tester.

npm test

TODO

  • fix: by demoting and promoting headers, unless the maximum / minimum level reached
  • report an error if the document start at a level higher than the minimum allowed (starts with h3 while h1 allowed), and demote levels accordingly
  • report an error if a child header increased the level by more than one

License

MIT © aborazmeh

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published