All Projects → amweiss → Angular Diff Match Patch

amweiss / Angular Diff Match Patch

Licence: mit
An AngularJS wrapper for google-diff-match-patch

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Angular Diff Match Patch

Kayn
superagent-inspired Node.js lib (w/ **some** TypeScript support) for accessing Riot's League of Legend's API (discord: cnguy#3614)
Stars: ✭ 122 (-9.63%)
Mutual labels:  wrapper
Winmerge
WinMerge is an Open Source differencing and merging tool for Windows. WinMerge can compare both folders and files, presenting differences in a visual text format that is easy to understand and handle.
Stars: ✭ 2,358 (+1646.67%)
Mutual labels:  diff
Golive
⚡ Live views for GoLang with reactive HTML over WebSockets 🔌
Stars: ✭ 130 (-3.7%)
Mutual labels:  diff
Colore
A powerful C# library for Razer Chroma's SDK
Stars: ✭ 121 (-10.37%)
Mutual labels:  wrapper
Learnvue
Vue.js 源码解析
Stars: ✭ 11,516 (+8430.37%)
Mutual labels:  diff
Pokeapi Js Wrapper
PokeAPI browser wrapper, fully async with built-in cache
Stars: ✭ 129 (-4.44%)
Mutual labels:  wrapper
Apkdiffpatch
a C++ library and command-line tools for Zip(Jar,Apk) file Diff & Patch; create minimal delta/differential; support Jar sign(apk v1 sign) & apk v2,v3 sign .
Stars: ✭ 121 (-10.37%)
Mutual labels:  diff
Git Cola
git-cola: The highly caffeinated Git GUI
Stars: ✭ 1,787 (+1223.7%)
Mutual labels:  diff
Php Diff
A comprehensive library for generating differences between two strings in multiple formats (unified, side by side HTML etc).
Stars: ✭ 126 (-6.67%)
Mutual labels:  diff
Dukglue
A C++ binding/wrapper library for the Duktape JavaScript interpreter.
Stars: ✭ 132 (-2.22%)
Mutual labels:  wrapper
Ahk Libs
AutoHotkey library archive.
Stars: ✭ 125 (-7.41%)
Mutual labels:  wrapper
Prettydiff
Beautifier and language aware code comparison tool for many languages. It also minifies and a few other things.
Stars: ✭ 1,635 (+1111.11%)
Mutual labels:  diff
Rcloneexplorer
rclone GUI for Windows
Stars: ✭ 129 (-4.44%)
Mutual labels:  wrapper
Daff
Diff, patch and merge for data.frames, see http://paulfitz.github.io/daff/
Stars: ✭ 121 (-10.37%)
Mutual labels:  diff
Diffchar.vim
Highlight the exact differences, based on characters and words
Stars: ✭ 132 (-2.22%)
Mutual labels:  diff
Phoenix Diff
See the changes needed when upgrading an Elixir Phoenix application
Stars: ✭ 120 (-11.11%)
Mutual labels:  diff
Rialto
Manage Node resources with PHP
Stars: ✭ 128 (-5.19%)
Mutual labels:  wrapper
Mastodonkit
MastodonKit is a Swift Framework that wraps Mastodon's API
Stars: ✭ 134 (-0.74%)
Mutual labels:  wrapper
Libfaketime
libfaketime modifies the system time for a single application
Stars: ✭ 1,932 (+1331.11%)
Mutual labels:  wrapper
Diff2html
Pretty diff to html javascript library (diff2html)
Stars: ✭ 1,867 (+1282.96%)
Mutual labels:  diff

angular-diff-match-patch

npm CircleCI Codecov

David David

This library is simply a wrapper around google-diff-match-patch.

Simple

(Shown here with some custom styles)

Angular 2 Port

Should you wish to use this in an Angular 2+ project, take a look at this port: elliotforbes/ng-diff-match-patch

Setup

Install from NPM

npm install amweiss/angular-diff-match-patch

Install from Bower

bower install angular-diff-match-patch

Usage with webpack

  config.plugins = [
    new webpack.ProvidePlugin({
      diff_match_patch: 'diff-match-patch'
    }),
  ];

Usage

See the included demo for reference or view a sample on Codepen.

<pre line-diff left-obj="left" right-obj="right"></pre>

Where left and right are defined on your scope. The options attribute can be used as well, but it's optional.

$scope.options = {
  editCost: 4,
  attrs: {
    insert: {
      'data-attr': 'insert',
      'class': 'insertion'
    },
    delete: {
      'data-attr': 'delete'
    },
    equal: {
      'data-attr': 'equal'
    }
  }
};

editCost is specific to processingDiff and controls the tolerence for hunk separation. attrs can contain any/all/none of the following: insert, delete, and equal where the properties in those objects represent attributes that get added to the tags.

Another option is to skip angular processing the diff, it's useful when you want to show a diff of a code pre-compiled by angular. The attribute you need to add is called: skipAngularCompilingOnDiff. If set to true, would skip compiling, otherwise it would compile the diff.

Add some style

.match{
  color: gray;
}

.ins{
  color: black;
  background: #bbffbb;
}

.del{
  color: black;
  background: #ffbbbb;
}

Development

Development work requires npm from Node.js

Begin with:

npm install

Then you can use:

npm start To host the directory so you can see the demo

npm test To run the Jasmine tests once

npm test-watch To run the Jasmine tests with change detection

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].