Repository navigation
fix(diff): preserve HTML nesting and word-separating whitespace in structural diff - #112
Merged
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
cleanupUnbalancedDiffTagsinsrc/markdown/structuralDiff.tsto remove whitespace-only<ins>/<del>tags only at block boundaries, preserving word-separating whitespace (e.g. soft line breaks) and collapsing adjacent opposite-polarity whitespace pairs in running text to a single space.fixInvalidNestinginsrc/markdown/structuralDiff.ts:getTagDepthso inline closing tags opened inside<ins>/<del>(e.g.<ins><code>a</code></ins>) are not moved outside the diff tag.<ins>/<del>.blockRegexwithfindClosing()-basedpromoteBlockDiffsso nested block-like containers are not cut short at inner close tags and non-promoted blocks still balance diff tags at block boundaries.src/test/unit/structuralDiffIntegrity.test.tsand updatefixtures/expected/comprehensive.html.overlayscreenshot capture insrc/test/visual/mapping_proof.test.tsusingboundingBox()+page.screenshot({ clip }).Verification
pnpm run compile && pnpm run lint && npx mocha ./out/test/unit/**/*.test.js(315 passing)src/test/visual/mapping_proof.test.tsandsrc/test/visual/vrt.test.ts(comprehensive-v1-v2 - split-light) passed