Massoud Mazar

Sharing The Knowledge

NAVIGATION - SEARCH

formatting C# code in your BlogEngine.net blogs

I thought this may save someone a little time:

WHen using BlogEngine.net 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:

[code:c#] 

zzz 

[/code] 

(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. BlogEngine.net extension formats your code beautifully.

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

Add comment