# @lezer/html

> lezer-based HTML grammar

Latest version **1.3.13** (published 2025-12-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install @lezer/html
pnpm add @lezer/html
yarn add @lezer/html
bun add @lezer/html
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.3.13 |
| Published | 2025-12-22 |
| First published | 2021-08-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 91.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 17 |
| Author | Marijn Haverbeke |
| Maintainers | marijn |

## Links

- npm: https://www.npmjs.com/package/@lezer/html
- Repository: https://github.com/lezer-parser/html
- Homepage: https://github.com/lezer-parser/html#readme
- Issues: https://github.com/lezer-parser/html/issues
- npm.io page: https://npm.io/package/@lezer/html

## Dependencies (3)

- [@lezer/lr](https://npm.io/package/@lezer/lr.md) ^1.0.0
- [@lezer/common](https://npm.io/package/@lezer/common.md) ^1.2.0
- [@lezer/highlight](https://npm.io/package/@lezer/highlight.md) ^1.0.0

## Recent versions

- 1.3.13 (latest) — 2025-12-22
- 1.3.12 — 2025-09-26
- 1.3.11 — 2025-09-25
- 1.3.10 — 2024-05-29
- 1.3.9 — 2024-02-21
- 1.3.8 — 2023-12-28
- 1.3.7 — 2023-11-23
- 1.3.6 — 2023-07-12
- 1.3.5 — 2023-07-03
- 1.3.4 — 2023-03-27
- 1.3.3 — 2023-02-21
- 1.3.2 — 2023-02-16
- 1.3.1 — 2023-02-11
- 1.3.0 — 2022-12-16
- 1.2.0 — 2022-11-25
- … 8 more at https://npm.io/package/@lezer/html/versions

## README

# @lezer/html

This is an HTML grammar for the
[lezer](https://lezer.codemirror.net/) parser system.

The code is licensed under an MIT license.

## Interface

This package exports two bindings:

**`parser`**`: Parser`

The parser instance for the basic HTML grammar. Supports two dialects:

 - `"noMatch"` turns off tag matching, creating regular syntax nodes
   even for mismatched tags.

 - `"selfClosing"` adds support for `/>` self-closing tag syntax.

**`configureNesting`**`(tags?: {`\
`  tag: string,`\
`  attrs?: (attrs: {[attr: string]: string}) => boolean,`\
`  parser: Parser,`\
`}[], attributes?: {`\
`  name: string,`\
`  tagName?: string,`\
`  parser: Parser,`\
`}[]): ParseWrapper`

Create a nested parser config object which overrides the way the
content of some tags or attributes is parsed. Each tag override is an
object with a `tag` property holding the (lower case) tag name to
override, and an optional `attrs` predicate that, if given, has to
return true for the tag's attributes for this override to apply.

The `parser` property describes the way the tag's content is parsed.

---
_Source: https://npm.io/package/@lezer/html · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
