# @types/html-parser

> TypeScript definitions for html-parser

Latest version **0.11.5** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/html-parser
pnpm add @types/html-parser
yarn add @types/html-parser
bun add @types/html-parser
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.11.5 |
| Published | 2023-11-07 |
| First published | 2019-10-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51448 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/html-parser
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/html-parser
- npm.io page: https://npm.io/package/@types/html-parser

## Recent versions

- 0.11.5 (latest) — 2023-11-07
- 0.11.2 (ts3.7) — 2021-10-20
- 0.11.1 (ts3.6) — 2021-07-08
- 0.11.0 (ts2.4) — 2019-10-09
- 0.11.4 — 2023-10-18
- 0.11.3 — 2023-09-16

## README

# Installation
> `npm install --save @types/html-parser`

# Summary
This package contains type definitions for html-parser (https://www.npmjs.com/package/html-parser).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/html-parser.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/html-parser/index.d.ts)
````ts
export type Callback = (arg: any) => any;
export type Token = ">" | "/>" | "?>";

export interface CallbacksOption {
    attribute?(name: string, value: any): void;
    openElement?(tagName: string): void;
    closeOpenedElement?(tagName: string, token: Token, isUnary: boolean): void;
    closeElement?(name: string): void;
    comment?(content: string): void;
    docType?(content: string): void;
    cdata?(content: string): void;
    xmlProlog?(): void;
    text?(value: string): void;
}

export interface RegExpOptions {
    name?: RegExp | undefined;
    attribute?: RegExp | undefined;
}

export interface RemovalCallback {
    attributes?: Callback | string[];
    elements?: Callback | string[];
    comments?: Callback | boolean;
    docTypes?: Callback | boolean;
}

export function parse(htmlString: string, callbacks?: CallbacksOption, regex?: RegExpOptions): void;

export function parseFile(
    fileName: string,
    encoding: string | undefined,
    callbacks: CallbacksOption,
    callback: Callback,
): void;

export function sanitize(htmlString: string, removalCallbacks?: RemovalCallback): string;

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 03:09:37 GMT
 * Dependencies: none

# Credits
These definitions were written by [Vladimir Grenaderov https://github.com/VladimirGrenaderov,
//                 Max Boguslavskiy](https://github.com/maxbogus).

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