May 13, 2007

Microformat for code?

I have been doing a lot of studying lately to try and sharpen up my OO programming knowledge/skills. I have seen a lot of code examples - some beautifully laid out, some not.

Peeking at the HTML shows even more diversity. Some folks relying on the classic PRE / CODE pairing and others using non-breaking spaces and FONT tags!

I checked on Google and the Microformat site but haven't seen any examples or even mention of a microformat replacement (enhancement?) of CODE and PRE.

I'm not surprised. It's a huge undertaking - probably.

I imagining something that would indent properly, would allow color-coding and all that would certainly provide better accessibility - colon's could be handled by the :after and :before pseudo-selectors - yeah, ideal world and all that. It should probably allow easy transformation from the HTML to a code editor AND allow easy cut and paste.

Something of this complexity would need a little app. to generate the appropriate end result.

Differing coding languages could be a problem but the syntactic sugar such as semi-colons, curly braces, indents etc. could possibly be handled by the CSS.

For example:


public class Exampleclass
{
    public Exampleclass()
    {
       // do some constructor stuff here
    }
}

There's a lot going on in just that small example. Even a slightly more complex class would have to include definitions for: fields, properties, methods, events, access modifiers, compiler directives, variable definitions, reserved keywords, built-in functions/methods/properties, etc.. whew!!

There has to be something better than PRE and CODE!

Posted by dottie at 4:45 PM | Comments (0) | TrackBack