Skip to content

Diff parsing misinterprets file names for standard diff command #557

@jrk

Description

@jrk

If I want to diff plain files, independent of git, the natural thing to do is something like:

diff -u file1.js file2.js | diff2html -i stdin

This generally works, but it does not parse the filenames correctly. diff by default renders the filename header like this:

--- file1.js	2025-04-06 13:33:10
+++ file2.js	2025-04-07 09:10:40

The parser swallows the timestamps as part of the filename, too, which (1) is distracting clutter and (2) breaks syntax highlighting since it can't interpret the file type from the suffix anymore.

getFilename in diff-parser.js should be able to strip off these suffixes. I think they're always rendered with a \t character between the filename and the time, so it should be pretty straightforward.

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