|
| 1 | +// Type definitions for diff2html |
| 2 | +// Project: https://github.com/rtfpessoa/diff2html |
| 3 | +// Definitions by: rtfpessoa <https://github.com/rtfpessoa/> |
| 4 | +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped |
| 5 | + |
| 6 | +declare namespace Diff2Html { |
| 7 | + |
| 8 | + export interface Options { |
| 9 | + inputFormat?: 'diff' | 'json'; |
| 10 | + outputFormat?: 'line-by-line' | 'side-by-side'; |
| 11 | + showFiles?: boolean; |
| 12 | + diffStyle?: 'word' | 'char'; |
| 13 | + matching?: 'lines' | 'words' | 'none'; |
| 14 | + matchWordsThreshold?: number; |
| 15 | + matchingMaxComparisons?: number; |
| 16 | + maxLineSizeInBlockForComparison?: number; |
| 17 | + maxLineLengthHighlight?: number; |
| 18 | + templates?: object; |
| 19 | + rawTemplates?: object; |
| 20 | + renderNothingWhenEmpty?: boolean; |
| 21 | + } |
| 22 | + |
| 23 | + export interface Line { |
| 24 | + content: string; |
| 25 | + type: string; |
| 26 | + oldNumber: number; |
| 27 | + newNumber: number; |
| 28 | + } |
| 29 | + |
| 30 | + export interface Block { |
| 31 | + oldStartLine: number; |
| 32 | + oldStartLine2?: number; |
| 33 | + newStartLine: number; |
| 34 | + header: string; |
| 35 | + lines: Line[]; |
| 36 | + } |
| 37 | + |
| 38 | + export interface Result { |
| 39 | + addedLines: number; |
| 40 | + deletedLines: number; |
| 41 | + isCombined: boolean; |
| 42 | + isGitDiff: boolean; |
| 43 | + oldName: string; |
| 44 | + newName: string; |
| 45 | + language: string; |
| 46 | + blocks: Block[]; |
| 47 | + oldMode?: string; |
| 48 | + newMode?: string; |
| 49 | + deletedFileMode?: string; |
| 50 | + newFileMode?: string; |
| 51 | + isDeleted?: boolean; |
| 52 | + isNew?: boolean; |
| 53 | + isCopy?: boolean; |
| 54 | + isRename?: boolean; |
| 55 | + unchangedPercentage?: number; |
| 56 | + changedPercentage?: number; |
| 57 | + checksumBefore?: string; |
| 58 | + checksumAfter?: string; |
| 59 | + mode?: string; |
| 60 | + } |
| 61 | + |
| 62 | + export interface Diff2Html { |
| 63 | + getJsonFromDiff(input: string, configuration?: Options): Result[]; |
| 64 | + getPrettyHtml(input: any, configuration?: Options): string; |
| 65 | + } |
| 66 | +} |
| 67 | + |
| 68 | +declare module "diff2html" { |
| 69 | + var d2h: { "Diff2Html": Diff2Html.Diff2Html }; |
| 70 | + export = d2h; |
| 71 | +} |
0 commit comments