HTML *is* code

While watching Scoble’s new firehose gush, I saw an interesting fish come flopping out: a post on formatting code in blogs.

With a little poking around, I discovered that jaybaz_ms is a C# developer working on Visual Studio for Microsoft, apparently a nice guy with an interest in clear code. He also apparently doesn’t believe that HTML is code.

His solution to formatting code in blog posts is to write the code in Visual Studio, paste it into Word, where it gets a border drawn around it, then the result is apparently pasted into his weblog app. The result is HTML, the code that produces his webpage, which includes things like <p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: Tahoma;"><o:p>&nbsp;</o:p></span></p>
<div style="border: 1pt solid windowtext; padding: 1pt;">
<p class="MsoNormal" style="border: medium none ; margin: 0in 0in 0pt; padding: 0in;"><span style="font-size: 10pt; font-family: 'Courier New';"><span style="">&nbsp;&nbsp;&nbsp; </span><span style="color: blue;">void</span>
which gets us as far as the first word. I’m pretty sure there is a rule for having only three of four values for something like margin, though I can’t remember how it works, or why you would want to do that, with two different units, when all the values are zero. If the namespace prefix o is defined somewhere, I didn’t spot it, but I love (in the way that means “hate”) a (undeclared) namespaced (supposed) paragraph which contains only a single non-breaking space. I haven’t got a clue what “windowtext” is supposed to mean in the context of a border declaration, though. Is that a proprietary shortcut to set it to the color of some text somewhere in some window?

Of course, I do understand the difference between programming code that you expect others to have to read and work with, and HTML that you don’t expect anyone to look at, but none the less I say “bless your poor souls” to all browser developers everywhere, and “for shame!” to both the developers of Word, and to Jay and anyone else who understands the value of clean and clear code, but still emits HTML like that.

(My method for posting code? <pre><code>…</code></pre>. Works for me.)

16 Comments

Comment by nick #
2004-04-05 21:21:23

ack. motherf-ing ack. by posting that code, i think you made me miss whatever the point of the post was besides ”goddam that’s some ugly code.”

Comment by Phil Ringnalda #
2004-04-05 21:34:36