A web-based tool for comparing text documents side by side, similar to what you'd see on GitHub when reviewing pull requests. This application helps you visualize differences between two pieces of text with clear highlighting and detailed statistics.
Live Demo: https://diff-checker-wheat.vercel.app/
- Side-by-side comparison of two text documents
- Line-by-line diff visualization with color coding
- Character-level highlighting for subtle changes within lines
- GitHub-style interface with familiar red and green highlighting
- Synchronized scrolling between the two comparison panes
- Live statistics showing added, removed, and unchanged lines
- Interactive controls including swap sides, clear all, and copy diff
- Responsive design that works on different screen sizes
- Real-time updates as you type
- Open the application in your web browser
- Click the "Code" button to open the input panel
- Enter your original text in the left textarea
- Enter the modified text in the right textarea
- The differences will appear automatically below
- Swap Sides: Switch the left and right text areas
- Clear All: Remove all text from both areas
- Copy Diff: Copy the diff output to your clipboard in standard format
- Red highlighting indicates lines that were removed
- Green highlighting indicates lines that were added
- Gray highlighting shows unchanged lines
- Bold text within lines highlights specific character changes
- Line numbers help you track where changes occur
- Statistics at the top show the total count of each type of change
If you want to run this application locally:
- Make sure you have Node.js installed (version 18 or higher)
- Clone this repository
- Install dependencies:
npm install
- Start the development server:
npm run dev
- Open your browser to
http://localhost:5173
To create a production build:
npm run build
You can preview the production build locally:
npm run preview
This application is built with:
- Svelte 5 - Modern reactive framework with runes
- SvelteKit - Full-stack framework for Svelte
- TypeScript - Type-safe JavaScript
- Tailwind CSS - Utility-first CSS framework
- Shadcn Svelte - Component library for Svelte
- Vite - Fast build tool and development server
The diff comparison uses a sophisticated algorithm based on the Longest Common Subsequence (LCS) to find optimal alignments between texts. This ensures that:
- Large blocks of identical text are properly aligned
- Only actual changes are highlighted
- The results are consistent regardless of text order
If you'd like to contribute to this project:
- Fork the repository
- Create a feature branch
- Make your changes
- Run the linter and type checker:
npm run check npm run lint
- Test your changes thoroughly
- Submit a pull request
This project is open source and available under the MIT License.