executablebooks / mdformat

CommonMark compliant Markdown formatter
https://mdformat.rtfd.io
MIT License
437 stars 46 forks source link

Format output as filename:lineno: message #434

Open pawamoy opened 6 months ago

pawamoy commented 6 months ago

Context

Consoles within IDEs (or even in regular shell sessions) very often support the syntax filename:lineno: and allow clicking on such strings to open the corresponding file, at the corresponding line number, in the current IDE or in the preferred editor.

I understand that line numbers might not be correct after modification of Markdown files, but they're at least probably very close to the right ones.

Proposal

I suggest changing the output format from

Warning: Failed formatting content of a yaml code block (line 214 before formatting). Filename: /media/data/dev/website/docs/posts/save-pytest-logs-as-artifact-gitlab-ci.md

to

/media/data/dev/website/docs/posts/save-pytest-logs-as-artifact-gitlab-ci.md:214: warning: Failed formatting content of a yaml code block

Maybe even use a relative path if possible:

docs/posts/save-pytest-logs-as-artifact-gitlab-ci.md:214: warning: Failed formatting content of a yaml code block

Maybe also concatenate the additional information at the end of the message, so instead of two lines:

docs/posts/save-pytest-logs-as-artifact-gitlab-ci.md:214: warning: Failed formatting content of a yaml code block
error: Failed to parse at 1:1: Unexpected token Indent

...concatenate as one:

docs/posts/save-pytest-logs-as-artifact-gitlab-ci.md:214: warning: Failed formatting content of a yaml code block: Failed to parse at 1:1: Unexpected token Indent

...though I'm not familiar with all the possible error messages so it might not make sense.

Tasks and updates

No response