Syntax highlighting for C# and SQL (with CodeRay)

Posted by Adrian O'Connor Tue, 24 Apr 2007 13:33:00 GMT

I am about to enable syntax highlighting for code extracts on the Arctus Blog.

For those that are interested, we will be using a Ruby module called CodeRay to generate the output. This will be done through a custom text filter in Typo.

Because our primary audience is .NET, and CodeRay only supports Ruby and HTML languages out of the box, I have written language plug-ins for C# (.cs) and SQL. SQL is still effectively ‘beta’ because I have made no attempt to verify that I have remembered all of the keywords, types and functions (using SQL Server 2005 as a base line). I think I have covered 95% of the most used features so I shall pick up the missing bits as they come to light.

The required files are available below. You should place them in CodeRay’s \lib\coderay\scanners folder. CodeRay caches its scanners so you may need to reload your project. The two new languages are identified using “cs” and “sql”.

Comments

Leave a response

Comments