yigityalim
projectshandbookslabshireshare
xgithub
siteprojectshandbookslabschangelog
aboutusesnowhireshare
elsewherexgithublinkedinemail
metarssllms.txtsitemap
© 2026 Yiğit Yalım. All rights reserved.
/
Back to Labs
May 10, 2026·data

Diff Viewer

Compare two pieces of text side-by-side or unified. LCS-based line diff with optional whitespace-ignore. Code review, manifest comparison, content drift.

diff · version-control · comparison

PreviousCubic-Bezier TesterNextJSON Formatter

Compare two files without dropping into a terminal, pushing to GitHub, or opening an IDE. Paste, see.

DiffViewer+4−3
@@ -1,6 +1,7 @@
1−function greet(name) {
2− console.log("hi, " + name);
3− return null;
1+function greet(name: string): string {
2+ const msg = `hi, ${name}`;
3+ console.log(msg);
4+ return msg;
45 }
56
67 greet("world");

Algorithm

LCS-based (Longest Common Subsequence) line-level diff. Builds an m×n DP table then back-traces to produce add/remove/context ops. Not full Myers but fast enough for sub-MB browser inputs (O(mn) time and space).

Views

  • Unified — git/diff format with +/− markers and line numbers. Compact, scroll-friendly.
  • Split — before/after columns side-by-side. Aligned with empty cells where one side has no counterpart.

Whitespace ignore

When enabled, the comparison normalizes via s.replace(/\s+/g, " ").trim() but displays the original lines. Useful for indent refactors — raises signal-to-noise.