Last time (just before I went mad at Windows Live Writer), I posted some modified code from the ASP.NET Wiki that I thought isn't worth posting to the Wiki, while still being worth a post in this blog (it was out of scope for the Wiki article).
But what I also had to note that the Wiki System is far far away from perfect.
So let's get to the nitty gritty details at the example of the good article on HttpWebRequest.
Click the edit button and get a standard (really nothing special) WYSYWIG editor that completely hides the markup from you.
Maybe somebody sees this as a good thing (editing MediaWiki isn't that great after all due to WikiText), but I think WYSIWYG is absolutely lame!
Let's get to the source. To get this look
The HTML code looks like this:
<div style="border: 1px dotted rgb(204, 204, 204); padding: 5px; background: rgb(239, 239, 239) none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; font-family: Courier New;">
<p style="margin: 0px;"><span style="color: blue;">If</span> <span style="color: blue;">Not</span> (IsPostBack) <span style="color: blue;">Then</span></p>
<p style="margin: 0px;"> <span style="color: blue;">Try</span></p>
<p style="margin: 0px;"> <span style="color: blue;">Dim</span> fr <span style="color: blue;">As</span> System.Net.HttpWebRequest</p>
<p style="margin: 0px;"> <span style="color: blue;">Dim</span> targetURI <span style="color: blue;">As</span> <span style="color: blue;">New</span> Uri(<span style="color: rgb(163, 21, 21);">"http://weblogs.asp.net/farazshahkhan"</span>)</p>
</div>
I hope this has just raised some eyebrows, it sure did when I saw it first. Hell that's the way Microsoft wants us to post code??
After all, ASP.NET is about code. It's about ASP.NET, so there will be code everywhere. And we're supposed to somehow (still don't know how) do the syntax highlighting manually, copy everything to the HTML surface in the shitty WYSYWIG editor and then let others come in and edit this crap?
Oh my god, man.. Wiki is all about editing, not about posting in the first place. If I want to write a new story on something I'd go off and post it to this blog.
But to edit just one line of code, you'd have to copy the whole code sample into some kind of IDE, edit it, export it in HTML, repost it to the Wiki's HTML view.
No way anyone would ever go through this hassle just to increase the readability of some sample. I mean, if I'm in for a 20 minute edit job just because I think the variable int x should be named double y_, I'd never even think about editing.
So, concluding: Sorry Microsoft, but try harder next time.
Posting Code to a Wiki about code should be as seamless as possible, and not providing the tools to do so is a shame!
There is a "Format option" called "Source code" in the WYSYWIG, but it doesn't do a damn thing, so we see people posting their code from Word (like in the CSVExport article), do some other weird stuff (look above!).
Get your act together Microsoft, create a <code> block that will get syntax-highlighted at the server or something like that. But don't depend on your users to put even more effort into their contributions!