HaveComputerWillCode.Com

Welcome!
Life is a Non-Deterministic Finite State Automata
Automation ? (*pGeekiness)++ : Code /eneration;

January 30, 2010

How to show code snippets in HTML

Filed under: Programming — Tags: , — admin @ 5:49 am

If you’re writing a programming blog, at some point you’ll need to show source code… which got me thinking: how? Can I preserve the rich text and color ¬†information I get when I copy from Visual Studio and paste into Outlook? Do I need an excuse to play with PowerShell for a while to parse text and belch out HTML code with all the colorization sorted?

No need! Alex Gorbatchev’s superb Syntax Highlighter is what you need:

using WooHoo;

public class : WOO
{
        System.Console.WriteLine("WoOoOoO");
}

He asks for a donation if you use it… but I don’t have PayPAL. When I get it sorted out here in Aus, I’ll be sure to send him a few bucks. The highlighter covers every language I’ll need to post on here – C#, C++, PowerShell, Perl, VBScript, JScript and so on.

Powered by WordPress