[uf-discuss] Formating Code

David House dmhouse at gmail.com
Mon Oct 31 13:41:07 PST 2005

On 31/10/05, Jacob Ham <hakejam at gmail.com> wrote:
> I was just thinking today about the way we format code.  After playing with
> it a little, I thought why not create a Microformat for formatting code?  As
> I see it, formatting code in this matter can reap the benefits that
> microformat provide.  Here is just a small example (very quick):

First, a question: are we marking up the elements of the code, or the
metadata of the code?

In my opinion, the first would be an extremely hard task to solve
given the wide variety of programming languages available. It would
also involve placing tags inside pre tags, which hurts machine
readability. Add to that that programming languages already have very
well-defined semantics, and it becomes obvious that marking up
individual bits of code becomes a bit pointless. I say wrap the code
in <pre><code>...</code></pre> and be done with it. Don't bother
marking up whatever's inside.

If we're marking up metadata, which I guess is your intention judging
by your example, then I'm all for it. Others may argue that a new
microformat is not necessary; simply using a mixture of hCard,
rel-license and a few other existing MFs would be sufficient, but I
disagree. Code has metadata specific to it, like version number,
documentation URL and so on which wouldn't fit under any other
umbrella format.

-David House, dmhouse at gmail.com, http://xmouse.ithium.net

More information about the microformats-discuss mailing list