[whatwg] <code> attributes

Jonas Sicking jonas at sicking.cc
Tue Jun 9 09:37:39 PDT 2009


On Thu, Jun 4, 2009 at 6:24 PM, Ian Hickson<ian at hixie.ch> wrote:
> 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.

Is there a reason you encourage class values rather than microdata
here? As I understood it, one of the things microdata was trying to
avoid was using the class attribute since there was concern that it
would collide with user values.

/ Jonas



More information about the whatwg mailing list