No longer updated: new and updated blog (including old content) at

Archive for, please update your bookmarks

Code snippets from Visual Studio to

Posted by Roy Triesscheijn on Tuesday 30 September, 2008

To keep everything nice and tidy I was hoping for some feature in WordPress to allow me to instert C# (or any style) code nicely. But wordpress wont even remember the indenting makeing everything gibberish unless I manually add spaces instead of tabs.

Many people use the <pre> tag but after some whining at the forums there is an actual function that does syntax highlighting and everything if you spell it exactly right.

Fill in your code between: {sourcecode language=’cshar’} … {/sourcecode} but replace the ‘{‘ and  ‘}’ by the standard brackets ‘[‘ and ‘]’. This works really nicely like here below.

public partial class Form1 : Form
        public Form1()

        private void buttonGenerate_Click(object sender, EventArgs e)
            string source = richTextSource.Text;
            textOutput.Text = source;

The FAQ item can be found here
Special thanks to user ‘a sacred path’


3 Responses to “Code snippets from Visual Studio to”

  1. EvilNando said

    Damn this is handy


  2. Glad you like it, took me some time to find it (it’s so hidden in the faq’s)

  3. milang said

    I have been searching for days for exactly this feature… thank the high heavens for your blog.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: