### Install TypeScript Types for HAST Source: https://github.com/syntax-tree/hast/blob/main/readme.md Install the necessary types for using HAST with TypeScript. ```sh npm install @types/hast ``` -------------------------------- ### HTML Doctype to HAST Doctype Source: https://github.com/syntax-tree/hast/blob/main/readme.md Example showing how an HTML doctype declaration is represented as a HAST doctype node. ```html ``` ```js {type: 'doctype'} ``` -------------------------------- ### HTML Comment to HAST Comment Source: https://github.com/syntax-tree/hast/blob/main/readme.md Example showing how an HTML comment is represented as a HAST comment node. ```html ``` ```js {type: 'comment', value: 'Charlie'} ``` -------------------------------- ### HTML Element to HAST Element Source: https://github.com/syntax-tree/hast/blob/main/readme.md Example demonstrating the conversion of an HTML anchor element with attributes to a HAST element node. ```html ``` ```js { type: 'element', tagName: 'a', properties: { href: 'https://alpha.com', className: ['bravo'], download: true }, children: [] } ``` -------------------------------- ### HTML Text to HAST Text Node Source: https://github.com/syntax-tree/hast/blob/main/readme.md Example showing how plain text within an HTML span is represented as a HAST text node. ```html Foxtrot ``` ```js { type: 'element', tagName: 'span', properties: {}, children: [{type: 'text', value: 'Foxtrot'}] } ``` -------------------------------- ### Properties Interface Source: https://github.com/syntax-tree/hast/blob/main/readme.md Defines the structure for properties associated with an element in HAST. It indicates that each field must be a PropertyName and its value a PropertyValue. ```idl interface Properties {} ``` -------------------------------- ### HAST Doctype Node Interface Source: https://github.com/syntax-tree/hast/blob/main/readme.md Interface definition for a Doctype node in HAST. ```idl interface Doctype <: Node { type: 'doctype' } ``` -------------------------------- ### HAST Root Node Interface Source: https://github.com/syntax-tree/hast/blob/main/readme.md Interface definition for a Root node in HAST, representing the document itself. ```idl interface Root <: Parent { type: 'root' } ``` -------------------------------- ### HAST Text Node Interface Source: https://github.com/syntax-tree/hast/blob/main/readme.md Interface definition for a Text node in HAST, representing plain text content. ```idl interface Text <: Literal { type: 'text' } ``` -------------------------------- ### PropertyName Type Definition Source: https://github.com/syntax-tree/hast/blob/main/readme.md Defines PropertyName as a string, representing keys on Properties objects that correspond to HTML, SVG, ARIA, XML, XMLNS, or XLink attribute names. ```idl typedef string PropertyName ``` -------------------------------- ### HAST Element Node Interface Source: https://github.com/syntax-tree/hast/blob/main/readme.md Interface definition for an Element node in HAST, including tagName, properties, and children. ```idl interface Element <: Parent { type: 'element' tagName: string properties: Properties content: Root? children: [Comment | Element | Text] } ``` -------------------------------- ### HAST Comment Node Interface Source: https://github.com/syntax-tree/hast/blob/main/readme.md Interface definition for a Comment node in HAST. ```idl interface Comment <: Literal { type: 'comment' } ``` -------------------------------- ### PropertyValue Type Definition Source: https://github.com/syntax-tree/hast/blob/main/readme.md Defines PropertyValue as 'any', indicating that property values can be of any data type, reflecting the data type determined by their property name. ```idl typedef any PropertyValue ``` -------------------------------- ### HAST Parent Node Interface Source: https://github.com/syntax-tree/hast/blob/main/readme.md Interface definition for a Parent node in HAST, which can contain other HAST nodes as children. ```idl interface Parent <: UnistParent { children: [Comment | Doctype | Element | Text] } ``` -------------------------------- ### HAST Literal Node Interface Source: https://github.com/syntax-tree/hast/blob/main/readme.md Interface definition for a Literal node in HAST, which contains a string value. ```idl interface Literal <: UnistLiteral { value: string } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.