MD029: fix corrupted output for zero-padded list markers#2124
Open
chatman-media wants to merge 1 commit into
Open
MD029: fix corrupted output for zero-padded list markers#2124chatman-media wants to merge 1 commit into
chatman-media wants to merge 1 commit into
Conversation
The autofix computed how many characters to delete by re-stringifying the parsed numeric value (Number(text).toString().length), not by measuring the actual marker text. For a marker like "08." that value is 1 instead of 2, so the fix only removed the leading "0" and left garbage behind, e.g. "08." -> "18." instead of "1.". This only shows up with leading zeros, which the docs call out as an explicitly supported pattern for uniform indentation. Added a fixture that reproduces it and checked the fix is idempotent after the change (re-linting the fixed output finds nothing left).
Owner
|
Thank you! Please review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The autofix works out how many characters to delete by re-stringifying the parsed number (
Number(text).toString().length) instead of measuring the actual marker text. For a marker like08.that gives 1 instead of 2, so the fix only strips the leading0and leaves the rest behind —08.turns into18.instead of1.. Only shows up with leading zeros, which the MD029 doc explicitly calls out as supported for uniform indentation.Fixed by keeping the source text length around instead of recomputing it from the number. Added a fixture with a zero-padded list that reproduces the corruption and confirmed the fixed output re-lints clean.