mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-04-25 09:16:02 +03:00
[GH-ISSUE #80] Option to auto-fix rules? #65
Labels
No labels
bug
enhancement
enhancement
enhancement
fixed in next
fixed in next
fixed in next
new rule
new rule
new rule
pull-request
question
refactoring
refactoring
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/markdownlint#65
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @JoshuaKGoldberg on GitHub (Oct 22, 2017).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/80
For simple ones like indentation level complaints, how about providing an API to suggest fixes? Other linters such as ESLint and TSLint are doing this, and it's quite convenient (especially when editor extensions support it).
@JoshuaKGoldberg commented on GitHub (Oct 22, 2017):
See https://github.com/DavidAnson/vscode-markdownlint/issues/13.
IMO, it's a much better dev experience to embed fix information in the original rule itself (the way ESLint and TSLint do it).
@DavidAnson commented on GitHub (Oct 22, 2017):
Thanks! I’m evaluating how auto-fix works in practice in the VS Code extension. If it is a success, I will likely centralize it here as happened with highlighting.
@KvanTTT commented on GitHub (Oct 28, 2017):
I'm working on MarkConv utility that can convert markdowns of different kinds (GitHub, VisualCode, Habrahabr). Also, it warns about some style issues. Maybe it will be interesting and helpful for you.
@DavidAnson commented on GitHub (Oct 28, 2017):
@KvanTTT Interesting! Maybe also have a look at Pandoc which does something similar (I have never tried it): http://pandoc.org/
@KvanTTT commented on GitHub (Oct 28, 2017):
I know about pandoc but it supports not all features required for me.
@timocov commented on GitHub (Jan 13, 2018):
Seems that
markdown-itdoes not support generating markdown from AST :(@DavidAnson commented on GitHub (Jan 13, 2018):
Maybe have a look at what I have done in the VS Code extension. It can now fix about 15 rules automatically. Those are all of the ones that are unambiguous. There is another set of rules that can probably never be fixed automatically because it’s not possible to know what the right change is. And then there is a middle set that could maybe be fixed automatically, but would probably be unreliable because of the uncertainty. Not being able to use the parser is unfortunate, but not catastrophic as some rules that you’d want to fix are broken specifically because they do not parse successfully as Markdown.
@timocov commented on GitHub (Jan 16, 2018):
@DavidAnson could you take a look at
github.com/timocov/markdownlint@e2f674beeaplease?Possible this issue should be fixed something like that, but I am not sure and your comments will be very helpful to continue work.
@DavidAnson commented on GitHub (Jan 16, 2018):
This looks vaguely like one path I have considered. Some loose thoughts off the top of my head (in a meeting):
regexpin the next commit.How does this integrate with the VS Code extension?
Also, FYI that I am in the middle of significant refactoring in
nextbranch to enable user-defined rules, so I would caution against many changes tomasterin the near term.@JoshuaKGoldberg commented on GitHub (Jan 16, 2018):
Not to toot my own projects, but https://github.com/automutate/automutate answers a bunch of those questions 😉
In general, most linters apply "waves" of change/fix/mutation proposals. Mutations are removed until there are no overlaps, then all are applied in last-to-first order.
@KaiSchwarz-cnic commented on GitHub (Jun 7, 2018):
Morning! How can that autofix be activated in vscode? or is it activated by default?
@DavidAnson commented on GitHub (Jun 7, 2018):
For how to auto-fix rules in the VS Code extension, please see the bottom of this section: https://github.com/DavidAnson/vscode-markdownlint/blob/master/README.md#rules