This is a custom markdownlint rule to lint the alignment of list items and blocks (e.g. code blocks). For example:
Invalid ⛔ | Valid ✅ |
---|---|
Lorem ipsum dolor sit amet |
Lorem ipsum dolor sit amet |
* Lorem ipsum |
* Lorem ipsum |
1. Lorem ipsum |
1. Lorem ipsum |
* Lorem ipsum dolor sit amet |
* Lorem ipsum dolor sit amet |
1. Lorem ipsum dolor sit amet |
1. Lorem ipsum dolor sit amet |
* Lorem: |
* Lorem: |
> Lorem ipsum dolor sit amet |
> Lorem ipsum dolor sit amet |
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
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
This software is released under the MIT license. See the license file for more details.