# markdown/fenced-code-meta

> Require or disallow metadata for fenced code blocks

The text after the language on the opening fence is the block's metadata. Many documentation tools read a title, a file name or the lines to highlight from it. This rule keeps a project consistent: either every block with a language has metadata, or none does.

{/* 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-meta": "error" },
  },
];
```

It also works with `markdown/gfm`.

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

## Examples

Reported:

{/* bad */}

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

Not reported:

{/* good */}

````md
```js title="server.js"
const port = 3000;
```
````

A block without a language is not reported:

{/* good */}

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

## Options

| Option               | What it does                                      |
| -------------------- | ------------------------------------------------- |
| `"always"` (default) | A block that has a language needs metadata too.   |
| `"never"`            | No block can have anything after its language.    |

{/* bad {"options": ["never"]} */}

````md
```js title="server.js"
const port = 3000;
```
````

{/* good {"options": ["never"]} */}

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