MCPcopy Index your code
hub / github.com/rtfpessoa/diff2html / makeFileDiffHtml

Method makeFileDiffHtml

src/side-by-side-renderer.ts:62–84  ·  view source on GitHub ↗
(file: DiffFile, diffs: FileHtml)

Source from the content-addressed store, hash-verified

60 }
61
62 makeFileDiffHtml(file: DiffFile, diffs: FileHtml): string {
63 if (this.config.renderNothingWhenEmpty && Array.isArray(file.blocks) && file.blocks.length === 0) return '';
64
65 const fileDiffTemplate = this.hoganUtils.template(baseTemplatesPath, 'file-diff');
66 const filePathTemplate = this.hoganUtils.template(genericTemplatesPath, 'file-path');
67 const fileIconTemplate = this.hoganUtils.template(iconsBaseTemplatesPath, 'file');
68 const fileTagTemplate = this.hoganUtils.template(tagsBaseTemplatesPath, renderUtils.getFileIcon(file));
69
70 return fileDiffTemplate.render({
71 file: file,
72 fileHtmlId: renderUtils.getHtmlId(file),
73 diffs: diffs,
74 filePath: filePathTemplate.render(
75 {
76 fileDiffName: renderUtils.filenameDiff(file),
77 },
78 {
79 fileIcon: fileIconTemplate,
80 fileTag: fileTagTemplate,
81 },
82 ),
83 });
84 }
85
86 generateEmptyDiff(): FileHtml {
87 return {

Callers 2

renderMethod · 0.95

Calls 2

templateMethod · 0.80
renderMethod · 0.45

Tested by

no test coverage detected