Massoud Mazar

Sharing The Knowledge

formatting C# code in your blogs

I thought this may save someone a little time:

WHen using as your blogging tool, you can format your code using one of the extensions which comes with the tool.

some of the things to remember:

1- first create an opening and closing [code] tag surrounding some zzz characters. Simply type the characters in the editor, all lower case, and make sure to press "ENTER" after each line:




(ignore the space I added after the opening brackets)

2- Do not copy your code directly from Visual Studio. Copy it first to Notepad, then copy from Notepad to replace "zzz". Make sure it only replaces the 3 z characters, not the linefeed after them.

And that's it. extension formats your code beautifully.

UPDATE: BlogEngine now uses <pre></pre> tags for syntax highlighting. Please see