A custom markdownlint rule to ensure the proper alignment of indented content
npm install @silvermine/markdownlint-rule-indent-alignment



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 amet|
consectetur 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 amet|
consectetur 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
To use this custom markdownlint rule two things needed:
1. Update your [markdownlint config][markdownlint-config] to include
"indent-alignment": true
2. Add this rule to the list of [custom markdownlint rules][custom-rules-config].
If using markdownlint-cli, this
would look something like:
``bash`
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 of ul lists (number, default undefined)ul
* By default, child items will be aligned with the content. When ul_indent isul-indent
set, the rule will replicate the behavior of the [ (MD007)ul_indent: undefined
rule][md007].
* Examples:
*
`text`
* top-level item
* sub-item
* ul_indent: 3
`text`
* top-level item
* sub-item
* start_indent: Desired indention of all top-level lists (number, defaultundefined
)start_indent
* By default, top-level lists are allowed to be indented at any level as long as
it's consistent. When is set, then any top-level list must bestart_indent: 3
indented at that level.
* Examples:
*
`text
* top-level item
* sub-item
1. top-level item
1. sub-item
``
[markdownlint-config]: https://github.com/DavidAnson/markdownlint#optionsconfig
[custom-rules-config]: https://github.com/DavidAnson/markdownlint#optionscustomrules
[md007]: https://github.com/DavidAnson/markdownlint/blob/main/doc/md007.md
This software is released under the MIT license. See the license file for more
details.