[whatwg] <code> attributes

Ian Hickson ian at hixie.ch
Thu Jun 4 18:24:18 PDT 2009


On Tue, 28 Apr 2009, Jacob Rask wrote:
>
> has there ever been any discussion on including an attribute to the code 
> element, specify the programming language in the markup? If so, what was 
> the conclusion? I didn't find anything in the list archives.
> 
> If not, I believe it would be a very good idea. Browsers could for 
> instance have default color codings for different languages, open 
> selected code/text in an editor associated with that language, etc...

On Tue, 28 Apr 2009, Nils Dagsson Moskopp wrote:
> 
> We would need a controlled vocabulary, of course.

On Tue, 28 Apr 2009, Michael A. Puls II wrote:
> 
> <http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-code-element>
> 
> For example: <code class="language-python"></code>

This has been discussed before, but the basic answer is "use the class 
attribute", at least for now. I would recommend, if this is a 
common-enough problem, that a group of people get together and define a 
common set of class attribute values for the <code> element, in the style 
of a Microformat. That way, we can build a common vocabulary that can then 
be made more formal in the next version of HTML.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list