# markdown/fenced-code-language

> Require languages for fenced code blocks

A fenced code block without a language gets no syntax highlighting, and tools that extract code blocks by language skip it. Indented code blocks can't have a language, so they're ignored.

{/* Generated by src/codegen/lint-rule-docs.ts. Do not edit this section. */}

## Configure

Off by default. It needs an ESLint config that says which files are in the language:

{/* skip */}

```js eslint.config.js
import markdown from "@eslint/markdown";

export default [
  {
    files: ["**/*.md"],
    plugins: { markdown },
    language: "markdown/commonmark",
    rules: { "markdown/fenced-code-language": "error" },
  },
];
```

It also works with `markdown/gfm`.

{/* End of the generated section. */}

## Examples

Reported:

{/* bad */}

````md
```
const port = 3000;
```
````

Not reported:

{/* good */}

````md
```js
const port = 3000;
```
````

## Options

| Option     | Default | What it does                                                                     |
| ---------- | ------- | -------------------------------------------------------------------------------- |
| `required` | `[]`    | The only languages that are allowed. An empty list allows any language.          |

{/* bad {"options": [{ "required": ["js", "sh"] }]} */}

````md
```javascript
const port = 3000;
```
````

{/* good {"options": [{ "required": ["js", "sh"] }]} */}

````md
```js
const port = 3000;
```
````
