Nijikodo - Code Syntax Highlighting Library for PHP
created August 3, 2010 at 12:44 pm
A while back I wrote about using TextMate to do code syntax highlighting for your blog. While I still consider that to be a perfectly valid method I realized it was pretty cumbersome after using it myself for a while.
I began to search far and wide for alternatives and while there are plenty around most of them are pretty bad. I came upon this post by Dominic Szablewski and was inspired to begin creating my own syntax highlighting library.
Where did the name Nijikodo come from?
I decided I wanted to use some Japanese word so I translated "rainbow" which turned into "niji" and "code" which turned into "kodo". I'm sure it isn't a perfect translation.
As far as the library goes it is pretty bare bones at the moment. I am basically adding onto it and improving it as I use it. It currently has support for PHP, CSS, HTML, and JavaScript. That being said, the generic code highlighting should work with most C-style languages. I am currently working on improving support for Command Line/Shell Scripting and Python.
A nice thing about this library is that languages can inherit from other languages. This means that regex patterns can be shared across multiple languages, for example, to match math operations or comments.
If you would like to see this library in action you can do so without leaving this site. I have updated every post on my blog to use Nijikodo for the syntax highlighting.
For additional demos and usage instructions go to:
http://www.craigiam.com/nijikodo
To check out the source and/or download the library go to:
http://www.github.com/ccampbell/nijikodo
If you would like to contribute feel free to contact me.
I began to search far and wide for alternatives and while there are plenty around most of them are pretty bad. I came upon this post by Dominic Szablewski and was inspired to begin creating my own syntax highlighting library.
Where did the name Nijikodo come from?
I decided I wanted to use some Japanese word so I translated "rainbow" which turned into "niji" and "code" which turned into "kodo". I'm sure it isn't a perfect translation.
As far as the library goes it is pretty bare bones at the moment. I am basically adding onto it and improving it as I use it. It currently has support for PHP, CSS, HTML, and JavaScript. That being said, the generic code highlighting should work with most C-style languages. I am currently working on improving support for Command Line/Shell Scripting and Python.
A nice thing about this library is that languages can inherit from other languages. This means that regex patterns can be shared across multiple languages, for example, to match math operations or comments.
If you would like to see this library in action you can do so without leaving this site. I have updated every post on my blog to use Nijikodo for the syntax highlighting.
For additional demos and usage instructions go to:
http://www.craigiam.com/nijikodo
To check out the source and/or download the library go to:
http://www.github.com/ccampbell/nijikodo
If you would like to contribute feel free to contact me.
0 comments