JavaScript code syntax highlighting library

If you own a technical website or blog you surely have wrote some posts that provide code examples and you surely want your code syntax highlighted. There are a lot of library and plugins out there that do the job good (e.g: Google Syntax Highlighter). Today we present an pretty cool alternative for code syntax highlighting called Rainbow.

So, to detail a bit .. Rainbow is a code syntax highlighting library that is written in JavaScript. The library is lightweight having only 1.4kb (way smaller than Google code syntax highlighter), its very easy to use,extendable and completely themable via CSS.

Rainbow provides a cool API with 4 main public methods (.color, .addClass, .onHighlight, .extend) which are very well documented on the syntax highlighter website. There is also an example on how to use and integrate with your project and ways to match a pattern.

JavaScript code syntax highlighting library

Code syntax highlighting library

View Rainbow

Leave a Reply