Skip to content

Commit faeb7b7

Browse files
authored
Merge pull request #226 from rtfpessoa/update-configurations
fix: Update typescript typings and default configuration options
2 parents defd8f3 + d131860 commit faeb7b7

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

src/diff2html.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@
1414
}
1515

1616
var defaultConfig = {
17-
wordByWord: true,
17+
inputFormat: 'diff',
1818
outputFormat: 'line-by-line',
19+
showFiles: false,
1920
matching: 'none',
2021
matchWordsThreshold: 0.25,
2122
matchingMaxComparisons: 2500,
2223
maxLineSizeInBlockForComparison: 200,
2324
maxLineLengthHighlight: 10000,
25+
templates: {},
26+
rawTemplates: {},
2427
renderNothingWhenEmpty: false
2528
};
2629

typescript/diff2html-tests.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ import Diff2Html = require('diff2html');
55
let d2h = Diff2Html.Diff2Html;
66

77
class Diff2HtmlOptionsImpl implements Diff2Html.Options {
8-
constructor(public inputFormat: string) {
9-
}
8+
constructor (public inputFormat: 'diff' | 'json') {
9+
}
1010
}
1111

1212
let strInput =
13-
'diff --git a/sample b/sample\n' +
14-
'index 0000001..0ddf2ba\n' +
15-
'--- a/sample\n' +
16-
'+++ b/sample\n' +
17-
'@@ -1 +1 @@\n' +
18-
'-test\n' +
19-
'+test1r\n';
13+
'diff --git a/sample b/sample\n' +
14+
'index 0000001..0ddf2ba\n' +
15+
'--- a/sample\n' +
16+
'+++ b/sample\n' +
17+
'@@ -1 +1 @@\n' +
18+
'-test\n' +
19+
'+test1r\n';
2020

2121
let strConfiguration = new Diff2HtmlOptionsImpl('diff');
2222
let diffInput = d2h.getJsonFromDiff(strInput, strConfiguration);

typescript/diff2html.d.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@
66
declare namespace Diff2Html {
77

88
export interface Options {
9-
inputFormat?: string;
10-
outputFormat?: string;
9+
inputFormat?: 'diff' | 'json';
10+
outputFormat?: 'line-by-line' | 'side-by-side';
1111
showFiles?: boolean;
12-
matching?: string;
13-
synchronisedScroll?: boolean;
12+
matching?: 'lines' | 'words' | 'none';
1413
matchWordsThreshold?: number;
1514
matchingMaxComparisons?: number;
15+
maxLineSizeInBlockForComparison?: number;
1616
maxLineLengthHighlight?: number;
17+
templates?: object;
18+
rawTemplates?: object;
19+
renderNothingWhenEmpty?: boolean;
1720
}
1821

1922
export interface Line {

0 commit comments

Comments
 (0)