I Modified GeSHi’s C# File

As noted before, to post code in WordPress, I use the ig:Syntax Hiliter plugin. It uses the GeSHi engine.
I recently decided to modify the way it colors C# code. In particular I wanted to separate XML style comments from regular comments.
To that end I modified the PHP code in GeSHi's C# file.

I changed following entry in the $language_data = array ( from:

PHP:
  1. 'COMMENT_SINGLE' => array(1 => '//', 2 => '#'),

to

PHP:
  1. 'COMMENT_SINGLE' => array(1 => '///', 2 => '//', 3 => '#'),

The /// has to come before the // so it can properly recognize the /// otherwise it sees it as another //.
Then I modified the following entry in 'STYLES' => array( to be like this:

PHP:
  1. 'COMMENTS' => array(
  2.    1 => 'color: #808080',
  3.    2 => 'color: #008080; font-style: italic;',
  4.    3 => 'color: #008080;',
  5.    'MULTI' => 'color: #008080; font-style: italic;'
  6.    ),

2 => is what it orginaly had as 1 =>, and I made 1 => to reflect the change I wanted there, which gives the XML style comments a gray color, while leaving regular comments green.

About Brian A. Thomas

I am the father of Ari and Sidd. I am the owner and administrator of this site.
CSharp, PHP, Programming, Site News, WordPress , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>