views:

1369

answers:

5

Hey bloggers out there! I've created Wordpress blog that I am hosting myself, and I'm having the hardest time figuring out the best way to add C# snippets to my blog. What do you all use?

I'm currently using the "SyntaxHighlighter Evolved" plugin, and it works great for the most part - the only problem is that switching back to the Visual Editor removes all of the whitsepace padding. I've tried wrapping the [sourcecode] tags in <pre>'s, but then the formatter doesn't work correctly.

Any help would be much appreciated. I've spent about 10 hours trying to come up with a robust solution, and no luck. Cheers!

+1  A: 

Use the WP-Syntax plugin. To use it, you wrap the code with a pre tag with a language attribute. Consolidates the effort.

+1  A: 

If Client-Side (JavaScript) Syntax Highlighting is also an option, I can recommend google-code-prettify, which works quite well. Only a little Code escaping is needed to make it zero-friction for me as an author, as I detailed in a posting.

Michael Stum
+3  A: 

See the blog post that I wrote on this exact question, which explains how to use SyntaxHighlighter and fix TinyMCE so that it doesn't mess up your white space or tags (you can either customize one of the tinymce files in Wordpress, or use a plugin to do it for you).

Yaakov Ellis
Thanks! That's solves my problem perfectly. I've drafted a blog post in your honor, I'll put it up tomorrow :).Thanks!
Charles
+1  A: 

You can use Windows Live Writer to write post for your blog and use Steve Dunns live writer plugin.

Morph