BlazorTextDiff v2026.02.23.33037
Breaking Changes
- Removed JavaScript interop — the component is now pure C#/Blazor. Remove the
<script src="_content/BlazorTextDiff/js/BlazorTextDiff.js"></script> tag from your HTML.
- Removed DI registration —
ISideBySideDiffBuilder and IDiffer no longer need to be registered. Remove any builder.Services.AddScoped<ISideBySideDiffBuilder, SideBySideDiffBuilder>() calls from Program.cs.
DiffStats constructor changed — now accepts both (DiffPaneModel? oldText, DiffPaneModel? newText) to correctly count deletions from the old pane. Previously only accepted a single pane, causing deletion counts to always be zero.
- Removed
ShowWhiteSpace parameter — this parameter no longer exists on TextDiff.
Added
- Character-level highlighting — changed lines now highlight the specific characters that differ, not just the whole line. Uses
CharacterChunker from DiffPlex for true per-character diffing.
- Word + character two-tier highlights — partially changed words get a soft background (
*-word class) with the specific changed characters strongly highlighted inside (*-character class). Fully changed words use the character-level class directly.
- Adjacent highlight merging — consecutive highlighted characters merge into a single smooth pill shape via CSS
:has() and + selectors. Rounded corners only appear on the first and last character in a run.
- CSS custom properties for highlight shape —
--diff-char-radius, --diff-char-padding, --diff-word-radius, --diff-word-padding for easy customization of highlight appearance.
Class parameter — pass additional CSS class(es) to the root diff-container element for scoped style overrides.
AdditionalAttributes splatting — unmatched HTML attributes (style, id, data-*, etc.) pass through to the root element.
IgnoreCase parameter — toggle case-insensitive diff comparison.
IgnoreWhiteSpace parameter — toggle whitespace-insensitive diff comparison.
- Interactive collapse/expand — the "..." collapse indicator is now a
<button> that toggles between "▼ Show more" and "▲ Show less".
- Inline SVG loading spinner — replaced the Bootstrap-dependent CSS spinner with a self-contained SVG animation.
- Dark mode — full dark theme via
@media (prefers-color-scheme: dark) with appropriate highlight colors.
- Responsive layout — panes stack vertically on narrow screens (
max-width: 768px).
- Reduced motion support —
@media (prefers-reduced-motion: reduce) disables transitions.
- Print styles — clean output when printing.
- Focus states — keyboard-accessible focus outlines on line numbers and badges.
- CI workflow — new
.github/workflows/ci.yml runs build + test on every push and PR.
- Unit tests — 38 tests across 4 test files covering
DiffStats, TextDiff, TextDiffLine, and TextDiffPane.
- Character highlight demo page —
Pages/CharacterHighlight.razor showing typo corrections and code refactoring examples.
Changed
- Project structure — moved projects under
src/ and tests/ directories.
- Package updates —
Microsoft.AspNetCore.Components.Web 9.0.8 → 9.0.13, Microsoft.AspNetCore.Components.WebAssembly 9.0.8 → 9.0.13, DiffPlex 1.8.0 → 1.9.0.
- Publish workflow — now manual-only (
workflow_dispatch). Automatic CI testing handled by the new ci.yml workflow.
- Deploy workflow — updated paths for
src/ structure, added test step before build.
- Demo pages refactored — consolidated from 5 pages to 3 (Home playground, Character Highlight, Async). Removed
IgnoreCaseDemo.razor, IgnoreWhitespaceDemo.razor, and SurveyPrompt.razor.
- README — complete rewrite documenting current API, all parameters, CSS custom properties table, highlight system explanation, and styling examples.
Fixed
- DiffStats deletion count — deletions are now correctly counted from the old text pane instead of always showing zero.
- CSS
rgba() with custom properties — rgba(var(--diff-border-primary), 0.3) doesn't work with hex values; replaced with color-mix(in srgb, var(...) 30%, transparent).
- Loading spinner text — fixed the spinner so the text doesn't spin along with the icon.
Removed
BlazorTextDiff.js — JavaScript file deleted; all functionality is now pure C#.
BlazorDiff.scss — SCSS source removed; CSS is maintained directly.
compilerconfig.json — SCSS compiler configuration removed along with related .csproj entries.
docs/readme.md — placeholder file removed.
SurveyPrompt.razor — unused demo component removed.
IgnoreCaseDemo.razor / IgnoreWhitespaceDemo.razor — consolidated into the main playground page.
📦 Package Information
- Version: 2026.02.23.33037
- Built: 22319135039
- Commit: e4f1225
📥 Installation
dotnet add package BlazorTextDiff --version 2026.02.23.33037
🔗 Links