Hacker for Hire

Code Snippet

Wyatt •

First off, Code Snippet 2.0 is not mine. I didn’t make it, I won’t take any credit for it. The original creator was the person who hosted a blog at http://blog.enargi.com/codesnippet/ (which no longer works and is apparently down for good; however, it is GPL.). I came across the plugin awhile ago and and I’ve decided that I couldn’t just let it be lost to the ages and I’ll let it live here as long as I’m able.

Straight from the readme.txt, Code Snippet 2.0 is is a WordPress plugin for displaying code with highlighting in blog posts. The plugin uses GeSHi syntax highlighter engine. I’ve seen others, but they’ve gone the way of the dodo and most of them didn’t have as many supported languages at Code Snippet 2.0. I also think that Code Snippet does a better job than the Code Auto-escape plugin.


The original author recommended always wrapping your code in a <pre> tag; however, I’ve found that you generally don’t need to. To use it, simply surround your code with as such and specify your language type:

[code lang="c"]
int main(int argc, char** argv) { return 0; }

And you get this:

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

Or you could do something like:

[code lang="php"]
echo “Hello World!”;

And get:

     echo "Hello World!";

If you find a bug in it, drop a comment or an email to wyatt dot neal at gmail and I’ll try my best to fix it for you.

Also, if you have find that your language isn’t here and you write your own GeSHi hack to work with it, let me know and I’ll drop a link on this page so that people can find you. Heck, I’ll even put it in the archive so the world can share it if you want. Here’s the list of supported languages:

Collapse Language List

  • 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
  • and many more!!!
comments powered by Disqus