WordPress: Code Formatting Plugin for your Blog

Sometimes my Googling skills are not what they ought to be.  I searched high and low for a code formatter for this blog, but for some reason I couldn’t come up with the search terms.  Seriously, in the real world, only a demented nerd would drool over the code presentation on other people’s blogs…but there I was, and my code looked like utter malarkey by comparison.

Code Syntax Highlighter

Finally, I got the bright idea to ask one of those drool worthy bloggers, Andrew Ferguson, what the secret sauce was.  The answer:  SyntaxHighlighter plugin available at WordPress.  This plugin is based on the javascript project of the same name here, by Alex Gorbatchev.

Here’s a little sample:

//Add JS libraris
function enqueueBWBPS(){

//enqueue BWB-PS Javascript
wp_register_script('tracs_js', get_bloginfo('wpurl') . '/wp-content/plugins/tracs/js/tracs.js', array('jquery'), '1.0');

A Code Formatting Alternative for .Net

If you’re just wanting to format some C#, VB.Net, or XML/HTML/ASP.net, here’s an online formatter from DotNetSlackers that will give you some pretty markup that you can paste into your Post:  Format Code.

Well, hopefully this post will make it a little easier for somebody having a bad Google day out there.  I’m just glad my code can at least look pretty visually now…we won’t talk about its technical elegance or lack thereof.




One Response to WordPress: Code Formatting Plugin for your Blog

  1. Vaidy January 13, 2010 at 1:00 pm #

    Exactly what I was looking for. Thanks!

Powered by WordPress. Designed by Woo Themes