Introducing Pepmint!
Posted on 23 April 2012
I am happy to introduce PepMint, a JAVA wrapper over the awesome Python’s Pygments code syntax highlighting library. With Pepmint you can easily syntax highlight your own piece of snippet using code. This essentially helps us to build tools that consume code and output HTML - blog engines, presentation tools, documentation generators etc.
Usage
Super-easy way to use the library is described in the example below,
public String highlight(String code, String language) {
Pepmint pepmint = null;
Lexer lexer = pepmint.newLexer(format);
Formatter formatter = pepmint.newHtmlFormatter(formatterParams);
String formattedCode = pepmint.highlight(code, lexer, formatter);
return formattedCode;
}
Dependencies
The library is self-contained and does not depend on any third-party library. It is built using,
- Java 1.6
- Jython 2.5.6
- Pygments 1.4
Project Links
More details on the project can be found on project home page,
http://www.sangupta.com/projects/pemint.
Source Code:
https://github.com/sangupta/pepmint
Downloads:
https://github.com/sangupta/pepmint/downloads
Issue Management:
https://github.com/sangupta/pepmint/issues
Usage Instructions:
https://github.com/sangupta/pepmint/blob/master/README.md
Have Fun Highlighting!