W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2015

Re: [whatwg] Using @type on <code> to specify the computer language

From: Andrea Rendine <master.skywalker.88@gmail.com>
Date: Sat, 9 May 2015 15:04:30 +0200
Message-ID: <CAGxST9nG9+fE8kTdZhuJhPDzmas+x-rBBT8rPp2SQmM_bG9Kbg@mail.gmail.com>
To: WHATWG List <whatwg@whatwg.org>
Mathias, mind that while libraries support using the @class attribute,
there's no standard between them about whether to use a prefix before
the language or if a prefix is necessary at all.
Besides, @class has no semantic value. It's true that the spec
suggests using "semantic" class names (instead of layout-inspired, I
mean), but there's no real meaning for that.

2015-05-09 14:48 GMT+02:00 Mathias Bynens <mathiasb@opera.com>:
> There is a de facto standard here that is already supported by most
> syntax highlighting libraries, based on this part of the spec:
> https://html.spec.whatwg.org/multipage/semantics.html#the-code-element
>
> “There is no formal way to indicate the language of computer code
> being marked up. Authors who wish to mark code elements with the
> language used, e.g. so that syntax highlighting scripts can use the
> right rules, can use the class attribute, e.g. by adding a class
> prefixed with "language-" to the element.”
>
> I’d prefer following that pattern over inventing a new one.
Received on Saturday, 9 May 2015 13:04:56 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:31 UTC