Public
Edited
Jun 13, 2024
Fork of Diff tool
Insert cell
Insert cell
Insert cell
diff("rtfm", "rtfpessoa")
Insert cell
Insert cell
diff = (left, right, options = {}) => {
const defaults = {
wrapper: html`<div>`,
outputFormat: "side-by-side",
drawFileList: false,
drawFileHeaders: false
};
const { wrapper, drawFileHeaders, ...opts } = { ...defaults, ...options };

const diff = jsdiff.createTwoFilesPatch(
left.name || "left",
right.name || "right",
"" + left,
"" + right,
undefined,
undefined,
{ context: options.context || 2 }
);
const json = diff2html.parse(diff);
wrapper.innerHTML = diff2html.html(json, opts);
if (!drawFileHeaders) {
for (const n of wrapper.querySelectorAll(".d2h-file-header")) n.remove();
}
return wrapper;
}
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more