@silvermine/markdownlint-rule-indent-alignment
v0.1.1
Published
A custom markdownlint rule to ensure the proper alignment of indented content
Downloads
991
Readme
markdownlint-rule-indent-alignment
What?
This is a custom markdownlint rule to lint the alignment of list items and blocks (e.g. code blocks). For example:
| Invalid :no_entry: | Valid :white_check_mark: | |----------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------| | Lorem ipsum dolor sit amet consectetur adipiscing elit. | Lorem ipsum dolor sit ametconsectetur adipiscing elit. | | * Lorem ipsum * Dolor sit amet | * Lorem ipsum * Dolor sit amet | | 1. Lorem ipsum * Dolor sit amet | 1. Lorem ipsum * Dolor sit amet | | * Lorem ipsum dolor sit ametconsectetur adipiscing elit | * Lorem ipsum dolor sit amet consectetur adipiscing elit | | 1. Lorem ipsum dolor sit amet consectetur adipiscing elit | 1. Lorem ipsum dolor sit amet consectetur adipiscing elit | | * Lorem: ```text hello world ``` | * Lorem: ```text hello world ``` | | > Lorem ipsum dolor sit amet > consectetur adipiscing elit | > Lorem ipsum dolor sit amet> consectetur adipiscing elit |
Usage
To use this custom markdownlint rule two things needed:
Update your markdownlint config to include
"indent-alignment": true
Add this rule to the list of custom markdownlint rules. If using markdownlint-cli, this would look something like:
markdownlint -r './node_modules/@silvermine/markdownlint-rule-indent-alignment/src/indent-alignment.js' -c .markdownlint.json README.md
Rule configuration
This rule has the following config options:
ul_indent
: Desired indention oful
lists (number
, defaultundefined
)- By default, child
ul
items will be aligned with the content. Whenul_indent
is set, the rule will replicate the behavior of theul-indent
(MD007) rule. - Examples:
ul_indent: undefined
* top-level item * sub-item
ul_indent: 3
* top-level item * sub-item
- By default, child
start_indent
: Desired indention of all top-level lists (number
, defaultundefined
)- By default, top-level lists are allowed to be indented at any level as long as
it's consistent. When
start_indent
is set, then any top-level list must be indented at that level. - Examples:
start_indent: 3
* top-level item * sub-item 1. top-level item 1. sub-item
- By default, top-level lists are allowed to be indented at any level as long as
it's consistent. When
License
This software is released under the MIT license. See the license file for more details.