Arctus Blog: Syntax highlighting for C# and SQL (with CodeRay)tag:blog.arctus.co.uk,2005:TypoTypo2007-05-04T10:11:22-04:00Adrian O'Connoradrian@arctus.co.ukurn:uuid:2c7888f7-3983-425b-83bc-1c9f4a8c98a42007-04-24T09:33:00-04:002007-05-04T10:11:22-04:00Syntax highlighting for C# and SQL (with CodeRay)<p>I am about to enable syntax highlighting for code extracts on the Arctus Blog.</p>
<p>For those that are interested, we will be using a Ruby module called <a href="http://coderay.rubychan.de/">CodeRay</a> to generate the output. This will be done through a custom text filter in Typo.</p>
<p>Because our primary audience is .NET, and CodeRay only supports Ruby and <span class="caps">HTML</span> languages out of the box, I have written language plug-ins for C# (.cs) and <span class="caps">SQL</span>. 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 <span class="caps">SQL</span> 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.</p>
<p>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”.</p>
<div style="border:solid 1px #ddd;background:#eee;padding:5px;">
<h6 style="margin:0px;font-size:9pt;"><a href="/files/coderay-scanners-cs-sql.zip">coderay-scanners-cs-sql.zip</a></h6>
</div>