https://github.com/aborazmeh/textlint-rule-header-levels
https://github.com/aborazmeh/textlint-rule-header-levels
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/aborazmeh/textlint-rule-header-levels
- Owner: aborazmeh
- License: mit
- Created: 2024-07-14T12:55:45.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2024-07-15T14:42:09.000Z (10 months ago)
- Last Synced: 2025-02-24T23:05:25.467Z (2 months ago)
- Language: TypeScript
- Size: 103 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# textlint-rule-header-levels [](https://github.com/aborazmeh/textlint-rule-header-levels/actions?query=workflow%3A"test") [](https://textlint.github.io/)
Specify the least and most allowed header levels
## Install
Install with [npm](https://www.npmjs.com/):
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)
```json
{
"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](https://github.com/textlint/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