-
-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MD053 shouldn't get auto-fixed on save by default (loosing useful content) #306
Comments
Lint-on-save is not the default, it is something you have opted into. Here is the documentation: https://github.com/DavidAnson/vscode-markdownlint#fix Something you may find useful is the ability to quickly quickly toggle linting on and off: https://github.com/DavidAnson/vscode-markdownlint#disable The suggestion to add warning/error as distinct states for each rule is tracked in the library repository here: DavidAnson/markdownlint#254 |
Ok. I still think it could be a good idea to distinguish between cosmetic and "potentially destructive" lints. Maybe it's just incorrect configuration on my side, but I find it kind of weird when lints like line wrapping (which could be easily automated) need to be fixed manually, but unused links just get deleted without warning. Speaking of line-wraps: |
MD013 can be configured to ignore code blocks or apply a different length to them: https://github.com/DavidAnson/markdownlint/blob/main/doc/md013.md |
Regarding this: |
The proposal for a per-rule setting to ignore/report/fix (with fix being the new option) is interesting. I think it only applies to the interactive editor scenario, though, because that's the only place where the "temporarily wrong but on purpose" scenario seems to make sense. Because of that, the configuration for this would belong in VS Code Settings instead of a |
I don't think the distinction is about temporality of the detected issue. It's about whether the fix should be automatic or performed manually by the user. Makes sense to me for non-interactive use as well:
|
And for "validation" runs (e.g. automatically deciding if the document should pass into production) the "warning" level could be split into two sub-levels (that would affect linters exit code or other means to signalize the binary pass/fail state):
|
There's a separate issue for separate warning versus error level. We can ignore that here. To my point above about this being an editor scenario only, people using the CLI can choose not to fix at all or can choose to fix just a subset of issues based on the configuration they pass in. All of that is already possible today. What seems unique about your scenario is that you temporarily want to allow issues as a reminder to address them. |
Is there way to disable "markdownlint.config": {
"MD053":false
} I also fully agree with @fedy-cz, I'd love vscode do same thing it does for MD051/link-fragments, that is warn be about unreferenced link with a squiggly line but I really don't want it to just delete those links. |
There are various ways to disable rules, they should be covered here: https://github.com/DavidAnson/vscode-markdownlint?tab=readme-ov-file#markdownlintconfig If what you tried above didn't work, you may need to use a mechanism with higher precedence. |
TLDR: Lint MD053 Link and image reference definitions should be needed should not be automatic.
Explanation:
While most of the linting rules are probably safe to do automatically "on save", MD053 probably isn't one of them. It breaks (I think a pretty common) workflow:
The gotcha:
If I save at any point between 1. and 2. I loose all my ref-links that I didn't use yet.
I can disable the lint completely in the config, but:
As a general rule:
Any lint that could potentially remove useful content should not be applied automatically (at least not by default).
It could be nice to be able to configure each lint at 3 possible levels:
But the important think is to have reasonable defaults that don't delete potentially useful content automatically.
The text was updated successfully, but these errors were encountered: