(diffInput: string | DiffFile[], configuration: Diff2HtmlConfig = {})
| 26 | } |
| 27 | |
| 28 | export function html(diffInput: string | DiffFile[], configuration: Diff2HtmlConfig = {}): string { |
| 29 | const config = { ...defaultDiff2HtmlConfig, ...configuration }; |
| 30 | |
| 31 | const diffJson = typeof diffInput === 'string' ? DiffParser.parse(diffInput, config) : diffInput; |
| 32 | |
| 33 | const hoganUtils = new HoganJsUtils(config); |
| 34 | |
| 35 | const { colorScheme } = config; |
| 36 | const fileListRendererConfig = { colorScheme }; |
| 37 | |
| 38 | const fileList = config.drawFileList ? new FileListRenderer(hoganUtils, fileListRendererConfig).render(diffJson) : ''; |
| 39 | |
| 40 | const diffOutput = |
| 41 | config.outputFormat === 'side-by-side' |
| 42 | ? new SideBySideRenderer(hoganUtils, config).render(diffJson) |
| 43 | : new LineByLineRenderer(hoganUtils, config).render(diffJson); |
| 44 | |
| 45 | return fileList + diffOutput; |
| 46 | } |
no test coverage detected
searching dependent graphs…