Fred Stevens-Smith
Fred Stevens-Smith

Reputation: 468

How best to parse and display Git patch (diff) info?

I want to display Github patches, and I don't want to write my own parser. Specifically we are parsing the files.patch like in this example from the Github API docs.

I was hoping for something like Google-Code-Prettify, but extensive Googling hasn't turned anything up. Is there anything to do this?

Upvotes: 5

Views: 3732

Answers (2)

Gluck
Gluck

Reputation: 2962

parse-diff (CoffeeScript as well, but shouldn't matter as it can be used in any JS context) sounds a better (more widely used, maintained) option.

Upvotes: 3

Mark Leighton Fisher
Mark Leighton Fisher

Reputation: 5703

Would node-diff-parser help? Admittedly, it appears to be in CoffeeScript rather than straight JavaScript.

Alternatively, you could try jonjonsonjr's diff-parse which looks to be in straight JavaScript.

Upvotes: 1

Related Questions