The Code Snippet Plugin, my favourite syntax highlighter plugin for WordPress

Posted by Daniel - 2,702 Views

CodeSnippet pluginThere is no doubt that I need a WordPress plugin to highlight my code examples for this blog. It’s a requirement since I publish many programming code example within this blog. I had tried some of them, mostly from the WordPress plugin repository. All of them are relatively good but if I ask myself which one is my favorite I choose CodeSnippet Plugin. Why? Most of the syntax highlight plugins I had tested did not perfectly display their formatted code with my current theme, while CodeSnippet does, it’s perfectly blend with my theme. I guess the first good impression what makes me choose to use the CodeSnippet but please remember that this is my opinion only, some of you may think that my opinion is not correct.



CodeSnippet
Plugin is a code highlighter plugin powered by the GeSHi engine. A large number of languages are supported and it can be easily extended. These are the supported languages mentioned on its readme file:

actionscript-french, actionscript, ada, apache, applescript, asm, asp, bash, caddcl, cadlisp, c_mac, c, cpp, csharp, css-gen, css, delphi, diff, div, dos, d, eiffel, freebasic, gml, html4strict, ini, inno, java, javascript, lisp, lua, matlab, mpasm, nsis, objc, oobas, oracle8, pascal, perl, php-brief, php, python, qbasic, sdlbasic, smarty, sql, vbnet, vb, vhdl, visualfoxpro, xml.

To use CodeSnippet within your post all you need to do is to put your code between its formatting tag. The example opening tag is [ code lang=”php” ] and the closing tag is [ /code ].

Following is an example of c code formatted with the plugin:

int main(int argc, char** argv) { return 0; }

CodeSnippet is class based so you can use it anywhere you want by creating the instance of the class. You can find the example here.

Download CodeSnippet (186 KB)

share this article

Digg del.icio.us Netscape StumbleUpon Yahoo! MyWeb reddit Furl Magnolia Newsvine Technorati SlashDot Blinklist Simpy Google
This post as PDFPosted in: Tested Software - February 2008

7 Responses to “The Code Snippet Plugin, my favourite syntax highlighter plugin for WordPress”

  1. Sterling | Bizlift Blog Says:

    I like how it displays code formatted with color. Thanks for sharing the tip!

  2. Daniel Says:

    @Sterling: You’re welcome :) Had visited your blog just now. I haven’t had time to explore it but it looks very useful..

    Thanks for passing by and I am sorry for very late reply..
    _____________

    Daniel

  3. Rosenrod Says:

    Thank you - I’ll be sure to check back later for more of your posts.

  4. Jacob Says:

    hey id like to talk with you about your blog. please email me - thanks.

  5. Daniel Says:

    @Jacob: Feel free to talk with me here…

  6. tresloukadu Says:

    yo how did u fixed when the tags shows <? and it shows < “& l t ; ” ?? please send me an email.

  7. Daniel Says:

    @tresloukadu: Simple, just save your post in CODE mode, the visual mode change that < to & lt;



Leave a Reply


Options for your comment:





Hi, my name is Daniel Nugraha, a single male live on an island called Java, Indonesia. This is the place for me to share my interest in computer programming.

Coffee Break

Comments - Thanks Guys :)

  • Rangga Kusuma: Gan, Tengkiu buat postingan yang sangat berguna. Kebetulan ada project utk bikin sms gateway, dan converter Agan sangat berguna utk...
  • Chuck Norton: I actually went ahead & bolted over to Justin’s Get The Image plugin here: http://justintadlock.com/ar...
  • Chuck Norton: Question: is it possible to insert something like [custfieldimg=”joice1.jpg,15 0,1:1″] into the actual templates instead of...
  • Therese Lachance: Hi, Any idea how to have ContuttoPDF fetch the correct page language?
  • tresloukadu: yo how did u fixed when the tags shows <? and it shows < “& l t ; ” ?? please send me an email.