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.
markdownlint
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.
install.md
```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.
.markdownlint.json
{
"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.
Related guides
markdownlint "MD033/no-inline-html" in CIFix markdownlint "MD033/no-inline-html: Inline HTML" failures in CI - the linter flags raw HTML tags in Markd…
markdownlint "MD013/line-length" line too long in CIFix markdownlint "MD013/line-length: Line length" failures in CI - a Markdown line exceeds the configured col…
markdownlint-cli2 config not found or not applied in CIFix markdownlint-cli2 in CI where the config is not found or not applied - rules fire that your local run doe…