Taylor Hunt taylorcharlesh...@gmail.com writes:
Hello,
I was wondering about the best way of indicating a code element's
contained computer language for syntax highlighting. The
specifications are quite clear that using @lang for that is abuse, so
many existing implementations use a
Long ago I proposed an attribute for code language because I was
unhappy with all the class=language-whatever thing. I proposed @lang
because I thought there could be an issue with speech synthesis and
languages, but it was effectively pointed out that such attribute does
not fit this case.
+1
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
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
Hello,
I was wondering about the best way of indicating a code element's
contained computer language for syntax highlighting. The
specifications are quite clear that using @lang for that is abuse, so
many existing implementations use a data-lang attribute, class name,
or something similar.
I was