DavidAnson / markdownlint-cli2

A fast, flexible, configuration-based command-line interface for linting Markdown/CommonMark files with the markdownlint library
MIT License
371 stars 47 forks source link

[FEAT] stdin support #414

Closed xudyang1 closed 1 week ago

xudyang1 commented 2 months ago

markdownlint-cli supports read from stdin, and markdownlint itself supports --stdin option to parse stdin input. Is it possible to make markdownlint-cli2 support stdin?

DavidAnson commented 2 months ago

I'll look into whether it is straightforward to do this by supporting - as with cat and tar. but if it is not, I will leave things as they are and recommend those other tools for this scenario.

FYI, I've asked before, and have not heard a particularly compelling scenario for why standard input was necessary versus creating and using a temporary file.

xudyang1 commented 2 months ago

I'll look into whether it is straightforward to do this by supporting - as with cat and tar. but if it is not, I will leave things as they are and recommend those other tools for this scenario.

FYI, I've asked before, and have not heard a particularly compelling scenario for why standard input was necessary versus creating and using a temporary file.

I would not say standard input is necessary for linting, but it does help editors like neovim to update diagnostics after changing the active buffer (without saving it to disk). Currently, nvim-lint uses markdownlint and markdownlint-cli2 without stdin support, and because of that, users have to save the buffer to see diagnostics update. I am also trying to customize my configuration to make markdownlint in nvim-lint work from standard input, in that case, I would like to stick with markdownlint if it works well.

Anyway, thank you for developing an amazing linting/formatting tool for markdown!