Project

black

0.0
No commit activity in last 3 years
No release in over 3 years
Black parses diff output to render a syntax-highlighted diff view in HTML
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 1
~> 3
 Project Readme

Black

Black parses diff output from diff and git diff and provides an enumerable ruby interface for lines and metadata.

Black uses this diff interface to render a syntax-highlighted diff view in HTML.

Status

Black isn't documented yet.

I'm getting this out for those who are compfortable diving into the source and getting some initial value from it.

Consider this a work in progress.

Usage

diff = Black::Diff.new('older string', 'newer string', 'file-name.html')
output = Black::HTMLView.render(diff: diff)

The filename determines how the content will be highlighted.

The output is HTML only. To output the css:

css = Black::Stylesheets.css({ style: :compressed })

Black uses sass, so all options are passed right into sass options. Have a look at Black::Stylesheets for more info.

Version

0.0.1 - Please consider the API alpha and unstable.

Black adheres to Semantic Versioning

Dependencies

  1. rouge for syntax highlighting
  2. sass for stylesheet management

Rubies

Tested with ruby 1.9.3+

ruby 1.8.x not supported

Platforms

This only supports unix-based systems at the moment.

But the shell execution is wrapped like so:

# Black::Diff.execute()
def self.execute(*command_args)
  `diff #{ command_args.join(' ') }`
end

So you can reimplement this method to suit your own platform needs:

class Black::Diff
  def self.execute(*command_args)
    # do some custom stuff
  end
end

License

MIT