Skip to content
NewBun 1.4.5 is out. Release notes
AphrodyBun

Linter · Rules

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.

Configure

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

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.

Examples

Reported:

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

Not reported:

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

A block without a language is not reported:

```
const port = 3000;
```

Options

OptionWhat it does
"always" (default)A block that has a language needs metadata too.
"never"No block can have anything after its language.
```js title="server.js"
const port = 3000;
```
```js
const port = 3000;
```