Skip to content

Consider adding support for writing to stdout when reading from stdin #603

@bil0u

Description

@bil0u

I am trying to integrate markdownlint-cli2 as an external formatter in Zed editor. To do so, the formatter should be able to read some content from stdin and outputting the formatted content to stdout. (See official Zed docs)

I found that markdownlint-cli2 is able to read from stdin using the glob argument -, but does not print the formatted content to stdout when used in conjunction with --fix. Maybe this is a normal/desired behavior ?

Thanks for your time !

What did you do?

$ echo "# Title\n\n\n\nContent" | markdownlint-cli2 - --fix
markdownlint-cli2 v0.18.1 (markdownlint v0.38.0)
Finding:
Linting: 1 file(s)
Summary: 2 error(s)
stdin:3 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]
stdin:4 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 3]

What did you expect to happen?

I expected to get the formatted content as a direct output:

$ echo "# Title\n\n\n\nContent" | markdownlint-cli2 - --fix
# Title

Content

Context

  • Tool version: markdownlint-cli2 v0.18.1 (markdownlint v0.38.0)
  • Operating system: macOS Sequoia 15.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfixed in nextFixed in the "next" branch for the next release

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions