Title: Fix: Ensure equalities processed via new processEqualities hook (Fixes #219) by tusharsoni52 · Pull Request #224 · java-diff-utils/java-diff-utils · GitHub
Open Graph Title: Fix: Ensure equalities processed via new processEqualities hook (Fixes #219) by tusharsoni52 · Pull Request #224 · java-diff-utils/java-diff-utils
X Title: Fix: Ensure equalities processed via new processEqualities hook (Fixes #219) by tusharsoni52 · Pull Request #224 · java-diff-utils/java-diff-utils
Description: Summary This PR introduces a new extension point, processEqualities(), inside DiffRowGenerator to address the HTML-escaping issue described in #219. Previously, equal (unchanged) segments were passed through HTML normalization only once. Because < and > were normalized to < and >, equalities that began with & caused incorrect inline diff grouping (e.g., < vs >). This produced invalid HTML when inlineDiffByWord(true) was used. What This PR Changes ✔ Adds a new protected hook: protected String processEqualities(String text) ✔ All equality chunks now pass through this hook before becoming DiffRow(Tag.EQUAL, ...). ✔ Default behavior is no modification (fully backward compatible). ✔ Users can override this hook to customize HTML or text transformations after diffing, solving the core issue. Why this Fix Works The problem in #219 occurs because the diff logic compares normalized text, but the final output does not normalize equal segments the same way as diffs. By exposing processEqualities(), we give users a consistent post-diff transformation path. This ensures that equal text is handled symmetrically to diffed text and prevents HTML-breaking cases like < / > being partially diffed. Backward Compatibility Existing behavior is preserved. No breaking API changes. The feature is opt-in — users override it only if needed. Tests Included ✔ Added DiffRowGeneratorEqualitiesTest ✔ Verifies that: Equalities now route through processEqualities() Inline diffs still work correctly The issue #219 reproduction scenario no longer produces broken HTML Fixes Fixes #219
Open Graph Description: Summary This PR introduces a new extension point, processEqualities(), inside DiffRowGenerator to address the HTML-escaping issue described in #219. Previously, equal (unchanged) segments were pass...
X Description: Summary This PR introduces a new extension point, processEqualities(), inside DiffRowGenerator to address the HTML-escaping issue described in #219. Previously, equal (unchanged) segments were pass...
Opengraph URL: https://github.com/java-diff-utils/java-diff-utils/pull/224
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:541a195b-3a47-b33d-6597-4ee62e9f410d |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | CE28:495BB:C3E55C:10D914B:69689E33 |
| html-safe-nonce | 2f90afc424246b96ad7d534e9350c43c677043d2bd9c488a2e337326823fd20d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRTI4OjQ5NUJCOkMzRTU1QzoxMEQ5MTRCOjY5Njg5RTMzIiwidmlzaXRvcl9pZCI6Ijg1MzA5OTMwMzA5ODg2MDI5MzEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 1298c07591ec08298187e1ed37e7a0aef808d22e873679aad5bfdd13f0f19a68 |
| hovercard-subject-tag | pull_request:3055657713 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/java-diff-utils/java-diff-utils/pull/224/checks |
| twitter:image | https://avatars.githubusercontent.com/u/116971475?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/116971475?s=400&v=4 |
| og:image:alt | Summary This PR introduces a new extension point, processEqualities(), inside DiffRowGenerator to address the HTML-escaping issue described in #219. Previously, equal (unchanged) segments were pass... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | fdc7c66bd36a6c12eb8e771e806db863266e573fc299e77f27505a768d4f8a98 |
| turbo-cache-control | no-cache |
| go-import | github.com/java-diff-utils/java-diff-utils git https://github.com/java-diff-utils/java-diff-utils.git |
| octolytics-dimension-user_id | 40540835 |
| octolytics-dimension-user_login | java-diff-utils |
| octolytics-dimension-repository_id | 86663812 |
| octolytics-dimension-repository_nwo | java-diff-utils/java-diff-utils |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 86663812 |
| octolytics-dimension-repository_network_root_nwo | java-diff-utils/java-diff-utils |
| turbo-body-classes | logged-out env-production page-responsive full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3223a6503d318917691422cdadfbe16cd8fb21e5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width