# markdown/no-html

> Disallow HTML tags

Markdown passes HTML through unchanged, but not every renderer does: some strip it, some escape it, and MDX reads it as JSX. This rule limits a document to plain Markdown, or to a short list of allowed elements.

Each opening tag is reported. Closing tags and comments are not.

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

It also works with `markdown/gfm`.

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

## Examples

Reported:

{/* bad {"count": 2} */}

```md
<div align="center">

Press <kbd>Enter</kbd>.

</div>
```

Not reported:

{/* good */}

```md
Press **Enter**.

<!-- A comment -->
```

## Options

| Option              | Default | What it does                                                |
| ------------------- | ------- | ----------------------------------------------------------- |
| `allowed`           | `[]`    | The names of the elements that are allowed.                 |
| `allowedIgnoreCase` | `false` | Ignore case, so `KBD` is allowed if `kbd` is on the list.   |

{/* good {"options": [{ "allowed": ["kbd"] }]} */}

```md
Press <kbd>Enter</kbd>.
```

{/* bad {"options": [{ "allowed": ["kbd"] }]} */}

```md
Press <KBD>Enter</KBD>.
```

{/* good {"options": [{ "allowed": ["kbd"], "allowedIgnoreCase": true }]} */}

```md
Press <KBD>Enter</KBD>.
```
