isagalaev/highlight.js — pull request #195 by dimsmol (2013-03-19 17:14:27+00:00)
Title: Node build improved

* package structure fixed
* core class extracted to separate file, this allows to load it without requiring all the language modules
* added addLanguage(name, module) method to make languages adding easier

Latest two are very useful for bundling files using [browserify](https://github.com/substack/node-browserify). Now you can use standard package with full set of languages, but bundle for client side only subset you need:

```js
// code example for bundling
var Hightlight = require('highlight.js/lib/highlight');
var hl = new Hightlight();
hl.addLanguage('bash', require('highlight.js/lib/languages/bash'));
// no other languages will be required (and bundled)
```

Of course, you can also use the package as before:

```js
// will load all the laguages as usual
var hl = require('highlight.js');
```

**Also**, [fixed](https://github.com/dimsmol/highlight.js/commit/635f6b16f0465520ca6cef1eb86cb0e20152ca86) unnecessary and dangerous usage of global variable `hljs` in core class closure.

**And** note the line [509](https://github.com/dimsmol/highlight.js/commit/635f6b16f0465520ca6cef1eb86cb0e20152ca86#L0R509) - `tabReplace` property is used there, but it's never assigned (possibly bug).