Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including blackhighlighter with all npm packages installed. Try it out:

var blackhighlighter = require("blackhighlighter")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

blackhighlighter v0.9.11

Client and server for widget implementing secure and committed web redaction

Blackhighlighter logo

Blackhighlighter combines novel editing with in-browser cryptography to facilitate new ways of communicating. It is packaged as a jQuery widget (with no other dependencies), along with a server library that can be integrated into Node.JS projects as an npm module.

The best way to understand the idea is to see a running demo of a site that incorporates it. So please visit:

http://blackhighlighter.org

For philosophy, videos, and more articles about the project, see http://blackhighlighter.hostilefork.com/.

THIS PACKAGE

This package contains two key source files:

  • blackhighlighter.js - The server side logic for committing, retreiving, and revealing blackhighlighter commits. Commits are stored in a MongoDB database.

  • jquery-blackhighlighter/jquery-blackhighlighter.js - Code implementing the jQuery widget, as well as shared code loaded as a dependency by blackhighlighter.js. In order to avoid an actual dependency on jQuery in the Node code, a "fake" stub is loaded server-side (jquery-fake.js).

The 1.0 goal is to release a functional letter-writing service built on the blackhighlighter package. That is currently the demo service at blackhighlighter.org; which has a GitHub repository here:

https://github.com/hostilefork/blackhighlighter.org

USAGE

To include and configure blackhighlighter on the server side, you will need a MongoDB database URI where commits and reveals will be read/written:

var blackhighlighter = require('blackhighlighter');

blackhighlighter.configure({
    mongoConnectURI: "http://..."
});

You can serve the jquery-blackhighlighter.js and jquery-blackhighlighter.css files from directly inside of ./node_modules/blackhighlighter. The path to those files is given with blackhighlighter.pathForJqueryBlackhighlighter(). So for instance:

app.use("/public/js/jquery-blackhighlighter",
    express.static(blackhighlighter.pathForJqueryBlackhighlighter())
);

For the moment, there are expectations on the URL suffixes of the REST services hardcoded in the widget (relative to a base_url you pass it). See this issue for discussion:

https://github.com/hostilefork/blackhighlighter/issues/57

Thus the way to try using blackhighlighter in your project is essentially "do what the demo does". A good first start would be to get the demo working and understand it.

Going forward past 1.0, the API is adapting so that the widget can integrate more easily into other applications with a different workflow from blackhighlighter.org. Feedback is welcome.

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free