Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/chemzqm/highlight.js
- Owner: chemzqm
- Created: 2013-09-11T06:19:19.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-09-11T06:38:06.000Z (over 11 years ago)
- Last Synced: 2024-10-29T10:08:35.271Z (about 2 months ago)
- Language: JavaScript
- Homepage: http://softwaremaniacs.org/soft/highlight/en/
- Size: 223 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
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