An event and Promise based JavaScript parser and render (to HTML) for unified diff files.
JavaScript CSS
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
dist
src
.eslintrc
.gitignore
DEVELOPMENT.md
Gruntfile.js
LICENSE-MIT
README.md
package.json

README.md

Dreditor

An event and Promise based JavaScript parser and render (to HTML) for unified diff files.

// Get a patch from somewhere on the file system.
let string = require('fs').readFileSync('./some-unified-diff.patch', 'utf8');

// Create a new Dreditor instance.
let dreditor = require('dreditor')();

dreditor
  // Parse the data.
  .parse(string)
  .then(function (/** @type {Parser} */ parser) {
    // Do stParserer.render();
  })
  .then(function (/** @type {Element} */ output) {
    output.addClass('my-custom-class');
    console.log(output.toString());
  });