Skip to content

Commit e163e12

Browse files
author
Neil Fraser
committed
Update demos and convert readme to markdown.
1 parent e04089e commit e163e12

File tree

5 files changed

+31
-54
lines changed

5 files changed

+31
-54
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The Diff Match and Patch libraries offer robust algorithms to perform the
2+
operations required for synchronizing plain text.
3+
4+
1. Diff:
5+
* Compare two blocks of plain text and efficiently return a list of differences.
6+
* [Diff Demo](https://neil.fraser.name/software/diff_match_patch/demos/diff.html)
7+
2. Match:
8+
* Given a search string, find its best fuzzy match in a block of plain text. Weighted for both accuracy and location.
9+
* [Match Demo](https://neil.fraser.name/software/diff_match_patch/demos/match.html)
10+
3. Patch:
11+
* Apply a list of patches onto plain text. Use best-effort to apply patch even when the underlying text doesn't match.
12+
* [Patch Demo](https://neil.fraser.name/software/diff_match_patch/demos/patch.html)
13+
14+
Currently available in Java, JavaScript, Dart, C++, C#, Objective C, Lua and Python.
15+
Regardless of language, each library features the same API and the same functionality.
16+
All versions also have comprehensive test harnesses.
17+
18+
### Algorithms
19+
This library implements [Myer's diff algorithm](https://neil.fraser.name/writing/diff/myers.pdf) which is generally considered to be the best general-purpose diff. A layer of [pre-diff speedups and post-diff cleanups](https://neil.fraser.name/writing/diff/) surround the diff algorithm, improving both performance and output quality.
20+
21+
This library also implements a [Bitap matching algorithm](https://neil.fraser.name/writing/patch/bitap.ps) at the heart of a [flexible matching and patching strategy](https://neil.fraser.name/writing/patch/).

README.txt

Lines changed: 0 additions & 43 deletions
This file was deleted.

demos/demo_diff.html renamed to demos/diff.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<HTML>
33
<HEAD>
44
<TITLE>Diff, Match and Patch: Demo of Diff</TITLE>
5-
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript" SRC="../javascript/diff_match_patch.js"></SCRIPT>
5+
<SCRIPT SRC="../javascript/diff_match_patch.js"></SCRIPT>
66
</HEAD>
77

88
<BODY>
@@ -13,7 +13,7 @@ <H2>Demo of Diff</H2>
1313
The result of any diff may contain 'chaff', irrelevant small commonalities which complicate the output.
1414
A post-diff cleanup algorithm factors out these trivial commonalities.</P>
1515

16-
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
16+
<SCRIPT>
1717
var dmp = new diff_match_patch();
1818

1919
function launch() {
@@ -81,7 +81,7 @@ <H3>Post-diff cleanup:</H3>
8181
<DIV ID="outputdiv"></DIV>
8282

8383
<HR>
84-
Back to <A HREF="http://code.google.com/p/google-diff-match-patch/">Diff, Match and Patch</A>
84+
Back to <A HREF="https://github.com/google/diff-match-patch">Diff, Match and Patch</A>
8585

8686
</BODY>
8787
</HTML>

demos/demo_match.html renamed to demos/match.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<HTML>
33
<HEAD>
44
<TITLE>Diff, Match and Patch: Demo of Match</TITLE>
5-
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript" SRC="../javascript/diff_match_patch.js"></SCRIPT>
5+
<SCRIPT SRC="../javascript/diff_match_patch.js"></SCRIPT>
66
</HEAD>
77

88
<BODY>
@@ -13,7 +13,7 @@ <H2>Demo of Match</H2>
1313
This implementation of match is fuzzy, meaning it can find a match even if the
1414
pattern contains errors and doesn't exactly match what is found in the text.
1515
This implementation also accepts an expected location, near which the match should be found.
16-
The candidate matches are scored based on a) the number of spelling differences between the
16+
The candidate matches are scored based on a) the number of spelling differences between the
1717
pattern and the text and b) the distance between the candidate match and the expected location.
1818
The match distance parameter sets the relative importance of these two metrics.</P>
1919

@@ -49,7 +49,7 @@ <H3>Match threshold:</H3>
4949

5050
<DIV ID="datediv"></DIV>
5151

52-
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
52+
<SCRIPT>
5353
var dmp = new diff_match_patch();
5454

5555
function launch() {
@@ -86,7 +86,7 @@ <H3>Match threshold:</H3>
8686
</SCRIPT>
8787

8888
<HR>
89-
Back to <A HREF="http://code.google.com/p/google-diff-match-patch/">Diff, Match and Patch</A>
89+
Back to <A HREF="https://github.com/google/diff-match-patch">Diff, Match and Patch</A>
9090

9191
</BODY>
9292
</HTML>

demos/demo_patch.html renamed to demos/patch.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<HTML>
33
<HEAD>
44
<TITLE>Diff, Match and Patch: Demo of Patch</TITLE>
5-
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript" SRC="../javascript/diff_match_patch.js"></SCRIPT>
5+
<SCRIPT SRC="../javascript/diff_match_patch.js"></SCRIPT>
66
</HEAD>
77

88
<BODY>
@@ -19,7 +19,7 @@ <H2>Demo of Patch</H2>
1919
applies those patches onto the Star Trek parody, thus creating a Star Trek parody in
2020
Modern English.</P>
2121

22-
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
22+
<SCRIPT>
2323
var dmp = new diff_match_patch();
2424

2525
var patch_text = '';
@@ -114,8 +114,7 @@ <H3>Trekkie's copy:</H3>
114114
<DIV ID="patchdatediv"></DIV>
115115

116116
<HR>
117-
Back to <A HREF="http://code.google.com/p/google-diff-match-patch/">Diff, Match and Patch</A>
117+
Back to <A HREF="https://github.com/google/diff-match-patch">Diff, Match and Patch</A>
118118

119119
</BODY>
120120
</HTML>
121-

0 commit comments

Comments
 (0)