About This HTML Issue
The language tag yaml is reserved by IANA and cannot be used as a value for the lang attribute, which expects a valid BCP 47 language tag (like en for English or fr for French).
The lang attribute specifies the natural language of an element’s content — human languages like English, Spanish, or Japanese. It is not meant to indicate a programming or markup language. When you write lang="yaml" on a <code> element, the validator rejects it because yaml is a reserved IANA subtag with no valid use in BCP 47.
If your goal is to identify the code language for syntax highlighting or styling purposes, use the class attribute instead. A common convention, recommended by the HTML specification itself, is to use a class prefixed with language-, such as class="language-yaml".
HTML Examples
❌ Invalid: using lang for code language
<pre>
<code lang="yaml">
name: my-project
version: 1.0.0
</code>
</pre>
✅ Valid: using class for code language
<pre>
<code class="language-yaml">
name: my-project
version: 1.0.0
</code>
</pre>
This class="language-*" convention is widely supported by syntax highlighting libraries like Prism.js and highlight.js.
Find issues like this automatically
Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.