markdownlint icon indicating copy to clipboard operation
markdownlint copied to clipboard

Question: Is it possible to enforce indent of multiline list item?

Open ozkriff opened this issue 5 years ago • 5 comments

Is it possible to enforce the indentation of subsequent list item lines?

Like this

- text
  text
  text
- text
  text
  text

instead of

- text
text
text
- text
text
text

ozkriff avatar Nov 05 '20 15:11 ozkriff

Not today, but a new rule could do this.

DavidAnson avatar Nov 05 '20 16:11 DavidAnson

Yes, making multiline list indentations consistent would be great, including over-indented lines.

This is an exaggeration, but it would be great if markdownlint could spot this inconsistency:

* Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam aliquam,
est nec feugiat
  pharetra, arcu neque mattis turpis, a egestas nibh quam sit amet mi.
   Suspendisse et nulla mauris. Lorem ipsum dolor sit amet, consectetur
adipiscing elit. 

scottamain avatar Dec 22 '22 18:12 scottamain

FYI, I now realize that the auto-fix for MD007 actually causes this problem a bit, because a list item goes from this (extra list indentation):

  * Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam aliquam,
    est nec feugiat

To this:

* Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam aliquam,
    est nec feugiat

scottamain avatar Dec 22 '22 18:12 scottamain

👀

pwalleni avatar Jan 05 '23 17:01 pwalleni

@DavidAnson Or perhaps a new parameter for MD005/indentation? Something like multiline: true/false, which defaults to false so that it's not a breaking change?

indentation:
  multiline: true

I recently ran into a doc with a lot of inconsistency, so I did a search on the full docs set. Unfortunately, due to the number of contributors, I found that we had 1000+ examples of list items where the first line (both unordered and ordered) were aligned properly thanks to MD005, but the subsequent lines had no consistency. For example: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/140956/diffs (work not finished, see https://gitlab.com/gitlab-org/gitlab/-/issues/437118).

Ravlen avatar Jan 15 '24 08:01 Ravlen