Let me share my exeperience in this area. I ran into this problem during creating http://dotnettipoftheday.org. The goal was to provide users with ability to enter new tips which may contain C#/VB.NET code. And of course the code should be well formatted for easier reading. I tried JavaScript WYSIWYG editors but they are far from perfect. They don’t provide enough options to format code examples. Now, taking into account that all site users are .NET developers, I think that the best solution will be Silverlight WYSIWYG editor. Such editor can give you desktop-like experience and you have enough control over formatting.