markdownlint icon indicating copy to clipboard operation
markdownlint copied to clipboard

`markdownlint-disable-next-line` should apply to the next non-empty line

Open RebeccaStevens opened this issue 1 year ago • 1 comments

Ideally this should work.

<!-- markdownlint-disable-next-line MD013 -->

Some really looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong line

Additional Context

Prettier will always insert an empty line after comments in markdown.

RebeccaStevens avatar May 19 '24 10:05 RebeccaStevens

If you ask me, Prettier shouldn't break stuff like this just for fun. The meaning of "next line" is pretty clear in my mind and if we start trying to redefine it to mean "next line with content but hey is white space content well I don't know just take a guess", I think that could get confusing. :)

The example you show is possible today with the following pattern shown in the README:

<!-- markdownlint-capture -->
<!-- markdownlint-disable MD013 -->

looong line

<!-- markdownlint-restore -->

I am not inclined to add more complexity for this scenario as it seems pretty niche.

DavidAnson avatar May 19 '24 17:05 DavidAnson

Problem is that if a rule forces newlines (e.g. around headings), then you can't ignore a rule for that heading. Trying to use markdownlint-disable-line on the same line of the heading makes the fragment rule fail when trying to link to that heading (I guess a separate issue?)

jkieboom avatar Jul 01 '25 14:07 jkieboom