fix(site): enable word-level inline diff highlighting in DiffViewer#23423
Merged
DanielleMaywood merged 1 commit intomainfrom Mar 23, 2026
Merged
fix(site): enable word-level inline diff highlighting in DiffViewer#23423DanielleMaywood merged 1 commit intomainfrom
DanielleMaywood merged 1 commit intomainfrom
Conversation
The diffViewerCSS override was applying `background-color: transparent !important` to all `[data-line]` elements (except selected lines). This killed the library's colored backgrounds on change-addition and change-deletion lines, hiding both the line-level tint and the word-level emphasis highlights that @pierre/diffs computes by default. Narrow the transparent override to exclude `[data-line-type='change-addition']` and `[data-line-type='change-deletion']` so the library's built-in addition/deletion backgrounds and inline word-diff emphasis are preserved — matching the highlighting behavior users expect from GitHub's diff view.
0057ca6 to
32ec7d5
Compare
johnstcn
approved these changes
Mar 23, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Problem
Changed lines in the DiffViewer only had a full-line background tint with no indication of which specific words changed. This made it difficult to spot the actual modifications within a line, especially on lines with small edits.
Solution
Enable the
lineDiffType: "word"option from@pierre/diffsingetDiffViewerOptions. This adds a darker highlight on the specific changed words within addition/deletion lines, on top of the existing line-level background — matching the behavior users expect from GitHub's diff view.This applies everywhere
getDiffViewerOptionsis used: the mainDiffViewer, plus theTool,WriteFileTool, andEditFilesToolcomponents.