import { ParserBase } from './base'; import type { Position } from '../types'; import { RawMarkupKinds } from '../ast'; import type { LiquidHtmlNode, LiquidVariableOutput, LiquidRawTag, LiquidTag, TextNode, HtmlElement, HtmlVoidElement, HtmlSelfClosingElement, HtmlRawNode, HtmlComment, HtmlDoctype, HtmlDanglingMarkerClose, AttributeNode, ValueNode, LiquidNode, CompoundNameSegment } from '../ast'; /** * Interface capturing what HTML-parsing free functions need from the * DocumentParser. The parser class satisfies this contract, keeping * the coupling explicit and narrow. */ export interface HtmlParserDelegate extends ParserBase { readonly htmlParseHtml: boolean; htmlAllowUnclosedHtml: boolean; htmlInAttributeContext: boolean; htmlInAttributeValueContext: boolean; parseNode(): LiquidHtmlNode; parseLiquidVariableOutput(): LiquidVariableOutput; parseLiquidTag(): LiquidTag | LiquidRawTag; peekTagName(): string | null; isBlockTerminator(): boolean; parseBranchAttributes(): AttributeNode[]; parseLiquidInRange(bodyStart: number, bodyEnd: number): (LiquidNode | TextNode)[]; } export declare function parseHtmlElement(parser: HtmlParserDelegate): HtmlElement | HtmlVoidElement | HtmlSelfClosingElement | HtmlRawNode; export declare function parseHtmlRawBody(parser: HtmlParserDelegate, plainName: string, attributes: AttributeNode[], blockStartPosition: Position): HtmlRawNode; export declare function parseHtmlComment(parser: HtmlParserDelegate): HtmlComment; export declare function parseHtmlDoctype(parser: HtmlParserDelegate): HtmlDoctype; export declare function parseOrphanedHtmlCloseTag(parser: HtmlParserDelegate): never; export declare function parseHtmlDanglingMarkerClose(parser: HtmlParserDelegate): HtmlDanglingMarkerClose; /** * Parse attributes until a block terminator (end tag, branch keyword) is encountered. * Used inside Liquid tag branches that appear in HTML attribute context. */ export declare function parseBranchAttributesImpl(parser: HtmlParserDelegate): AttributeNode[]; export declare function parseCompoundName(parser: HtmlParserDelegate): CompoundNameSegment[]; export declare function parseAttributes(parser: HtmlParserDelegate): AttributeNode[]; export declare function parseQuotedAttributeValue(parser: HtmlParserDelegate): ValueNode[]; export declare function parseUnquotedAttributeValue(parser: HtmlParserDelegate): { value: ValueNode[]; end: number; }; /** * Consume the non-whitespace prefix of the current Text token. * If the token starts with whitespace, returns null (no name content). * If the entire token has no whitespace, consumes it entirely. * If whitespace is in the middle, mutates token.start to the whitespace * offset so the remainder stays for attribute parsing. */ export declare function consumeTextPrefix(parser: HtmlParserDelegate): TextNode | null; export declare function extractPlainName(name: CompoundNameSegment[]): string | null; export declare function peekHtmlCloseTagMatches(parser: HtmlParserDelegate, openName: CompoundNameSegment[]): boolean; export declare function scanForHtmlCloseTag(parser: ParserBase, tagName: string): number; export declare function rawMarkupKindForHtmlTag(tagName: string, attributes?: AttributeNode[], bodySource?: string): RawMarkupKinds;