mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-04-26 01:36:03 +03:00
[GH-ISSUE #535] MD013: Automatically fix line length #437
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#437
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 @PhilipNelson5 on GitHub (Jul 13, 2022).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/535
When rule MD013/line-length is enabled and markdownlint is fixing rule violations, it would be helpful if it could reflow a multiline paragraph. This would greatly improve productivity when editing paragraphs broken at a specific column.
@DavidAnson commented on GitHub (Jul 13, 2022):
This is a reasonable request, but it is not practical within the current constraints of the fix system. It’s also much more invasive than I think I’m comfortable with.
@PhilipNelson5 commented on GitHub (Jul 13, 2022):
That's fair, I have no idea what it would take to implement this. For anyone else looking for this feature, in vim
gqipwill format a paragraph and reflow it according to your configuredtextwidth. You still have to do it by hand on a paragraph by paragraph basis but it's far less tedious than reflowing the lines manually.@DavidAnson commented on GitHub (Jul 13, 2022):
Just to leave a note for anyone else who might look at this, there are two notable challenges that spring to mind:
Rule violations that offer a fix are only able to target a single line for edits. Reflow would typically involve multiple edits spanning multiple lines that need to be coordinated with each other. Improving the API is something I will do eventually, but it's not enough.
Applying multiple fixes at once works today by carefully ordering them so that they don't overlap or interfere with each other. That may not be possible with a paragraph reflow, so bulk fix operations may fail more often if reflow were attempted.