Syntax Highlighting!

Finally, I have beautiful syntax highlighting for the code snippets I put on my blog entries! Doing this is incredibly painful with TinyMCE, especially with tag-based code, because it would try to mess with the code.

Maybe I'll actually blog about specific code examples more often now, because I'll know I won't have the hurdle of wrangling with TinyMCE.

So now I can post beauteous code snippets like this:

CFM:
  1. <cfparam name="url.PerID" default="0">
  2. <cftry>
  3.     <cfscript>
  4.         cfcurl="http://site.com/ws/person.cfc?wsdl";
  5.         p=CreateObject("webservice",cfcUrl);
  6.     </cfscript>
  7.     <p>Hello, <cfoutput>#p.getName(url.PerID)#.</cfoutput></p>
  8.     <cfcatch type="any"><cfoutput>#cfcatch.message#</cfoutput></cfcatch>
  9. </cftry>

This is all thanks to the WordPress plugin by Amit Gupta over at iGeek.info called iG:Syntax Hiliter. You might note that it doesn't support ColdFusion out of the box. However, this plugin uses the GeSHI syntax highlighter, which does in fact support ColdFusion. So, as Adam Fortuna points out, getting ColdFusion syntax rendering is as easy as getting the cfm.php file from the GeSHI package and dropping it into iG:Syntax Hiliter's geshi directory.

After that, there may be some tweaking or style alterations you may want to make, but after activating the plugin, you're basically done. Thanks Amit!

One Response to “Syntax Highlighting!”

  1. Jennifer Says:

    Sorry! I been busy! I thought I did already actually. Doh!

    Yea, this is great. I’ve been looking for something *exactly* like this! Thanks!

  Theme Brought to you by Directory Journal and Elegant Directory.