0.11.5 • Published 6 months ago

@types/html-parser v0.11.5

Weekly downloads
65
License
MIT
Repository
github
Last release
6 months ago

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

// Type definitions for html-parser 0.11
// Project: https://www.npmjs.com/package/html-parser
// Definitions by: Vladimir Grenaderov https://github.com/VladimirGrenaderov,
//                 Max Boguslavskiy <https://github.com/maxbogus>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4

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: Wed, 20 Oct 2021 16:31:23 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by Vladimir Grenaderov https://github.com/VladimirGrenaderov, // Max Boguslavskiy.

0.11.3

8 months ago

0.11.4

7 months ago

0.11.5

6 months ago

0.11.2

3 years ago

0.11.1

3 years ago

0.11.0

5 years ago