Skip to content
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

MD013: Automatically fix line length #535

Open
PhilipNelson5 opened this issue Jul 13, 2022 · 3 comments
Open

MD013: Automatically fix line length #535

PhilipNelson5 opened this issue Jul 13, 2022 · 3 comments

Comments

@PhilipNelson5
Copy link

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 DavidAnson transferred this issue from DavidAnson/vscode-markdownlint Jul 13, 2022
@DavidAnson
Copy link
Owner

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
Copy link
Author

That's fair, I have no idea what it would take to implement this. For anyone else looking for this feature, in vim gqip will format a paragraph and reflow it according to your configured textwidth. 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
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants