Repository navigation
Add JSONHTML visual difference page - #97
Merged
Merged
Conversation
renderDifference(from:to:) renders two exact values as one static, script-free combined tree with added/removed/changed markers, a linked change list, a CSS-only changes-only toggle and native downloads of the RFC 6902 patch, source and target. The comparison moves into a package walker in JSON so JSONPatch.difference and JSONHTML share it and JSONHTML keeps depending on JSON only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ThorFuchs
force-pushed
the
feature/1.10-visual-diff
branch
from
November 14, 2026 15:17
7e323cf to
de2881a
Compare
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.
Stacked on #96 (base
feature/1.10-patch-diff); merge #96 first, then retarget this PR tomain.Summary
JSONHTMLRenderer.renderDifference(from:to:)andrenderDifferenceWithReportrender two exact values as one static, script-free combined tree:+, green), removed (−, red, struck through) and changed (old → new) values. Each marker carries visually hidden text, so the meaning does not depend on color.<details>; equal element runs collapse to "Elements #a–#b unchanged".application/json-patch+json), the source and the target (exact lexemes).script-src 'none'. The shared and difference stylesheets are authorized by SHA-256 hash, and all input is escaped.JSONWorkMeterwith the configuredJSONHTMLLimits; outline entries count one per listed change. Cancellation is checked inside the walk.Architecture
The comparison moves into a package
JSONDifferenceWalkerin JSON.JSONPatch.differencebecomes a facade over it, so JSONPatch and JSONHTML share one comparison, and JSONHTML still depends on JSON only. Within an array the patch order is now: paired changes, then removals from the highest index down, then additions. One expectation inDifferenceTestschanged for this; the semantics and round-trip behavior are unchanged.Docs and tooling
DifferenceRendering.md, linked from the JSONHTML landing page.Scripts/verify_html_assets.pynow also verifiesAssets/Difference.cssagainst its Swift mirror and hash (count 2 → 3,ci.pyupdated).Qualification (local)
Toolchain: Apple Swift 6.4.2 (swiftlang-6.4.2.1.9), macOS 27.3. Source:
7e323cfon24f6ada.python3 Scripts/ci.py --lane docs: exit 0, 4/4 commands passedpython3 Scripts/ci.py --lane native: exit 0, 62/62 commands passed, 0 failedI also rendered a sample page and checked it in a browser, including the changes-only toggle.
No tag, release or publication follows from this PR.
🤖 Generated with Claude Code