Skip to content

Is there a way to remove the ====== separator that appears at the top of diffs? #624

@iryan2

Description

@iryan2

I'm using jsdiff with react-diff-view and am finding myself having to remove the =================================================================== line that appears at the top of the output diff, like so:

    if (lines.length > 0 && lines[0].startsWith("======")) {
        // Find the first --- line and start from there
        const headerStart = lines.findIndex((line) => line.startsWith("---"));
        if (headerStart >= 0) {
            return lines.slice(headerStart).join("\n");
        }
    }

The reason appears to be the same as is described in this issue, in that react-diff-view expects diffs to be in either git diff or unidiff format.

Can you please help me understand why it gets included in jsdiff output, and whether there's a way to prevent it? I'd love to avoid having to strip it myself.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions