Skip to content

spskelly/diff-viewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Diff Viewer

A lightweight, installable PWA for diffing two pieces of text. Paste content into both sides — or drop files — and the diff renders instantly with side-by-side / unified toggle, word-level highlighting, and syntax highlighting.

Install

  1. Open spskelly.github.io/diff-viewer
  2. Install — click the install icon in the address bar, or use your browser menu and choose "Install Diff Viewer"
  3. Set as default (optional, Chromium only) — right-click a text file, choose "Open with", pick "Diff Viewer", enable "Always use this app"

That's it.

Chromium-based browsers (Chrome, Edge, Brave) get the file handler feature. Firefox and Safari can use the app but won't register it as a system file handler.

Features

  • Paste-first — drop two text snippets into the panes and see the diff immediately
  • File upload + drag-and-drop — fill either side from disk
  • Side-by-side / unified — toggle between the two layouts
  • Word-level highlighting — see exactly which words change inside a line
  • Syntax highlighting — 100+ languages via highlight.js (auto-detect or pick one)
  • Ignore whitespace — hide whitespace-only differences
  • Collapsed unchanged regions — long unchanged stretches collapse automatically
  • Dark / light mode — toggle with Ctrl+D, preference persists
  • Offline — works without internet after install
  • OS file handler — open one or two text files from your OS into the viewer
  • Keyboard shortcuts — press ? for the full list

Why?

A standalone, no-install-needed diff viewer. Most options are either heavy IDE features, online services that send your text to a server, or terminal tools. This is a tiny static page that runs locally, works offline, and registers as a file handler so two-file diffs from the file manager just work.

Development

Five files, no build:

  • index.html — app shell
  • app.js — state, diff pipeline, UI wiring
  • styles.css — layout + theme + diff2html overrides
  • manifest.json — PWA config and file handlers
  • service-worker.js — offline caching

Serve over http:// or https:// (not file://) for the service worker to register:

python -m http.server 8000
# then open http://localhost:8000/

License

MIT

About

Lightweight installable PWA for diffing two pieces of text

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors