UNPKG

799 BTypeScriptView Raw
1import { ParserOptions } from 'htmlparser2';
2import { SourceLocation } from './location-tracker.js';
3
4type Directive = {
5 name: string | RegExp;
6 start: string;
7 end: string;
8};
9type Options = {
10 directives?: Directive[];
11 sourceLocations?: boolean;
12 recognizeNoValueAttribute?: boolean;
13} & ParserOptions;
14type Tag = string | boolean;
15type Attributes = Record<string, string | number | boolean>;
16type Content = NodeText | Array<Node | Node[]>;
17type NodeText = string | number;
18type NodeTag = {
19 tag?: Tag;
20 attrs?: Attributes;
21 content?: Content;
22 location?: SourceLocation;
23};
24type Node = NodeText | NodeTag;
25declare const parser: (html: string, options?: Options) => Node[];
26
27export { Attributes, Content, Directive, Node, NodeTag, NodeText, Options, Tag, parser };