GitHub - danvk/codediff.js: Two-column JavaScript diff visualization with syntax highlighting (original) (raw)

codediff.js

⚠️ This repo has been folded into the webdiff monorepo and is no loner maintained. See webdiff#185 ⚠️

codediff.js is a two-column JavaScript diff visualization with syntax highlighting and character-by-character differences.

It was originally based on jsdifflib, but has been rewritten almost entirely.

Try the online demo!

Screenshot of webdiff in action

codediff.js is used by webdiff.

Usage

Here's the diff!

Options

Here are possible keys you can pass through the options parameter:

Here's an example usage with a filled-out options parameter:

$('#diffview').append( codediff.buildView(codeBefore, codeAfter, { language: 'python', beforeName: 'oldfilename.py', afterName: 'newfilename.py', contextSize: 8, minJumpSize: 5, expandLines: 5, wordWrap: true }));

Development

To iterate on the project locally, open one of the test*.html files.

To run the tests, run:

npm install
npm run watch
open test/index.html

To build, run: