fix: Support two-space list indentation tolerance - #7
Merged
Conversation
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.
Summary
This change supports two-space-step list nesting while retaining legacy odd-space indentation compatibility. Nested list markers are normalized before recursive block parsing, and regression coverage now includes 2-space, 3-space, and 4-space nesting.
Validation
The following local checks pass:
pnpm --filter @fuyeor/markdown-parser typecheckpnpm --filter @fuyeor/markdown-parser test:unitpnpm --filter @fuyeor/markdown-parser test:ffmgit diff --checkPerformance and package size
The benchmark used identical Node/Vitest settings and compared against
origin/main. Five runs were used for the flat and new nested scenarios; three runs were used for the legacy nested scenario.-0.7%)-42.6%)+0.9%)-42.9%)+47.9%)-25.1%)The new 2/4-space nested input now produces the requested nested AST, so its additional work reflects the newly enabled structure rather than a regression in the legacy-compatible path.
The npm package tarball increased from
43,063to43,647bytes (+584bytes,+1.36%); unpacked size increased by2,214bytes (+0.76%).CI note
The first GitHub Actions check currently fails during pnpm setup because the existing workflow requests pnpm
11.20.0while the repositorypackageManagerfield requests pnpm11.22.0. The failure occurs before dependency installation and before any project test runs; it is unrelated to this change.