[microformats-discuss] microformat for CODE snippets

Tantek Ç elik tantek at cs.stanford.edu
Mon Jul 11 08:43:24 PDT 2005


Hi Michiel


On 6/22/05 6:55 AM, "Michiel van der Blonk" <michiel at caribmedia.com> wrote:

> Content-Type: text/html; charset=ISO-8859-1

Polite reminder.  Please use only "plain text" (text/plain) on the
microformats mailing lists.


> Hi
> 
> I am a developer and would like to have a way of sharing code snippets
> or whole programs through XHTML. That way we can create a 'free source
> code' search engine, or just use google for it. And of course it should
> use the <code> tag.

Makes sense.


> We could use a lot of predefined class names to relate to the piece of code:
> - language
> - type (snippet/function/program/package)
> - title could describe the program
> 
> Example:
> <code class="PHP snippet" title="why eval is evil">
> $evil = eval($good);
> </code>
> 
> And while we are at it, why not use the same tags on links or meta tags,
> so that we can define this in multiple levels.
> 
> Hm, if the rel tag can be used on code, we might have to use that. What
> do you think?

These are some GREAT ideas Michiel.

I think you should start a wiki page, like:

 http://microformats.org/wiki/code-formats

And list exactly what you listed -- your usage scenarios (language, type,
etc.), and your strawman proposed format.

You should also look at what people are already doing.

There are two current practices that I know of:

1. <pre><code> to mean a "block of code" including whitespace

2. using the classname for the language, e.g. <code class="css">

Thanks,

Tantek



More information about the microformats-discuss mailing list