pygments
Version:
A pygments wrapper for nodejs
74 lines (48 loc) • 1.27 kB
Markdown
A pygments wrapper for node.js
```
curl http://npmjs.org/install.sh | sh
```
```
[] npm install pygments
```
* Default lexer is `js`
* Default format is `html`
```javascript
var highlight = require('pygments').colorize;
highlight('puts "Hello World"', 'ruby', 'console', function(data) {
console.log(data);
});
```
```javascript
var highlight = require('pygments').colorize;
highlight('/home/pkumar/package.json', null, 'html', function(data) {
console.log(data);
});
```
If you want to highlight string `/home/pkumar/package.json` itself,
```javascript
var highlight = require('pygments').colorize;
highlight('/home/pkumar/package.json', null, 'html', function(data) {
console.log(data);
}, {'force': true});
```
All of the pygments tests are written in [vows][4], and cover all of the use cases described above.
```
npm test
```
See LICENSE for details.
Pavan Kumar Sunkara
[] sss1991 [at] gmail [dot] com][email]
[]: mailto:pavan.sss1991@gmail.com
[]: http://vowsjs.org