/** * @since 0.0.1 */ import type { Forest } from 'fp-ts/Tree' import type { TagInfo } from './TagInfo' /** * Represents the hierarchical structure of an HTML document. Nodes of the tree * are spans which mark the starting and ending indices of the tag within the * token stream. The tree is organized such that tags that appear earlier in * the token stream appear earlier in the list of nodes, and that a given node * is completely within the span of its parent node. * * @category model * @since 0.0.1 */ export declare type TagForest = Forest /** * Represents the span of an HTML tag in terms of the index of the opening tag * and the index of the closing tag within the token stream. If there is not a * closing tag, the closing tag is equal to the opening tag. * * @category model * @since 0.0.1 */ export interface TagSpan { readonly start: number readonly end: number } /** * @category constructors * @since 0.0.1 */ export declare const TagSpan: (start: number, end: number) => TagSpan /** * Creates a `TagForest` describing the structure of a stream of tags annotated with * the span between their opening and closing tags. The nodes of the forest are tag * spans which mark the indices within the token info stream of an opening and * closing pair of tags. * * The tree is organized such that for any node `n` in the tree, the parent node `x` * of `n` is the smallest span that completely encapsulates the span of `n`. * * @category constructors * @since 0.0.1 */ export declare const fromTagInfo: (tokenInfo: ReadonlyArray) => Forest