Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/chemzqm/highlight.js

highlight.js as component
https://github.com/chemzqm/highlight.js

Last synced: about 1 month ago
JSON representation

highlight.js as component

Awesome Lists containing this project

README

        

# highlight.js

[highlight.js](http://softwaremaniacs.org/soft/highlight/en/) for component, works the same as highlight.js as nodejs module.

[Demo](http://chemzqm.github.io/highlight.js/index.html)

## Installation

Install with [component(1)](http://component.io):

$ component install chemzqm/highlight.js

## API

### hljs.highlight(lang, code)

Highlight the `code` with `lang`.

### hljs.highlightAuto(text)

Highlight the `text` with language auto detect.

## Example

``` js
var hljs = require('highlight.js');
var code = "var index = 123;\n var foo ='bar'\n";
var res = hljs.highlight('javascript', code);
//get the result code
console.log(res.value);
```

## License

MIT