Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

black

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

black

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

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

FAQs

Package last updated on 16 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc