markdownlint "MD040/fenced-code-language" in CI
markdownlint rule MD040 requires every fenced code block to declare a language after the opening fence, so syntax highlighting works. A bare ``` block fails the rule and the job exits non-zero.
What this error means
markdownlint reports "MD040/fenced-code-language Fenced code blocks should have a language specified" pointing at the opening line of a code fence.
docs/install.md:18 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]Common causes
A code fence opens without a language
The block starts with bare triple backticks instead of, say, ```bash, so MD040 flags it.
Plain-text blocks still need an explicit tag
Even non-code output needs a language such as text or console to satisfy the rule.
How to fix it
Add a language to every fence
Tag each opening fence with the language, or text/console for plain output.
```bash
npm ci
```
```text
plain output that is not code
```Allow a specific set of languages
Restrict MD040 to an allowed language list so typos in tags are also caught.
{
"MD040": { "allowed_languages": ["bash", "js", "ts", "json", "yaml", "text"] }
}How to prevent it
- Always tag fenced blocks with a language, using
textfor plain output. - Use
allowed_languagesto catch mistyped language tags. - Lint Markdown in pre-commit so untagged fences never reach CI.