Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jwilm/pygments-async
Fully asynchronous Node.js wrapper for Pygments
https://github.com/jwilm/pygments-async
Last synced: 7 days ago
JSON representation
Fully asynchronous Node.js wrapper for Pygments
- Host: GitHub
- URL: https://github.com/jwilm/pygments-async
- Owner: jwilm
- License: mit
- Created: 2014-01-01T01:13:53.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-01-02T04:15:04.000Z (almost 11 years ago)
- Last Synced: 2024-10-16T21:26:29.585Z (22 days ago)
- Language: JavaScript
- Homepage:
- Size: 137 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
pygments-async
==============Fully asynchronous wrapper for Pygments
## Usage
There are two functions exported by the package - pygmentize and pygmentizeFile.
### pygmentize
Highlight a block of code
Example:
```javascript
var pygmentize = require('pygments-async').pygmentize
, markup;pygmentize("puts 'Hello, world!'", {lexer: 'ruby'}, function(err, out) {
// out contains pygmentized code
markup = out;
});
```Allowed options are:
- `lexer`: Specify lexer for pygmentize
- `formatter`: Specify pygmentize lexerOptions need not be specified. If no lexer is provided pygmentize will attempt
to guess based on contents. The default formatter is `html`.### pygmentizeFile
Load a file and pygmentize it
```javascript
var pygmentize = require('pygments-async').pygmentize
, markup;pygmentizeFile("package.json", function(err, out) {
// out contains pygmentized package.json
markup = out;
});
```## License
MIT
## Alternatives
- [pygments](https://github.com/pksunkara/pygments.js)