@textlint/ast-node-types

  • Version 12.0.0
  • Published
  • 26.3 kB
  • No dependencies
  • MIT license

Install

npm i @textlint/ast-node-types
yarn add @textlint/ast-node-types
pnpm add @textlint/ast-node-types

Overview

textlint AST node type definition.

Index

Interfaces

interface TxtNode

interface TxtNode {}
  • Basic TxtNode Probably, Real TxtNode implementation has more properties.

property loc

loc: TxtNodeLineLocation;

    property parent

    parent?: TxtNode;

      property range

      range: TextNodeRange;

        property raw

        raw: string;

          property type

          type: TxtNodeType;

            index signature

            [index: string]: any;

              interface TxtNodeLineLocation

              interface TxtNodeLineLocation {}
              • Location

              property end

              end: TxtNodePosition;

                property start

                start: TxtNodePosition;

                  interface TxtNodePosition

                  interface TxtNodePosition {}
                  • Position's line start with 1. Position's column start with 0. This is for compatibility with JavaScript AST. https://gist.github.com/azu/8866b2cb9b7a933e01fe

                  property column

                  column: number;

                    property line

                    line: number;

                      interface TxtParentNode

                      interface TxtParentNode extends TxtNode {}
                      • Parent Node. Parent Node has children that are consist of TxtNode or TxtTextNode

                      property children

                      children: Array<TxtNode | TxtTextNode>;

                        interface TxtTextNode

                        interface TxtTextNode extends TxtNode {}
                        • Text Node. Text Node has inline value. For example, Str Node is an TxtTextNode.

                        property value

                        value: string;

                          Enums

                          enum ASTNodeTypes

                          enum ASTNodeTypes {
                          Document = 'Document',
                          DocumentExit = 'Document:exit',
                          Paragraph = 'Paragraph',
                          ParagraphExit = 'Paragraph:exit',
                          BlockQuote = 'BlockQuote',
                          BlockQuoteExit = 'BlockQuote:exit',
                          ListItem = 'ListItem',
                          ListItemExit = 'ListItem:exit',
                          List = 'List',
                          ListExit = 'List:exit',
                          Header = 'Header',
                          HeaderExit = 'Header:exit',
                          CodeBlock = 'CodeBlock',
                          CodeBlockExit = 'CodeBlock:exit',
                          HtmlBlock = 'HtmlBlock',
                          HtmlBlockExit = 'HtmlBlock:exit',
                          HorizontalRule = 'HorizontalRule',
                          HorizontalRuleExit = 'HorizontalRule:exit',
                          Comment = 'Comment',
                          CommentExit = 'Comment:exit',
                          ReferenceDef = 'ReferenceDef',
                          ReferenceDefExit = 'ReferenceDef:exit',
                          Str = 'Str',
                          StrExit = 'Str:exit',
                          Break = 'Break',
                          BreakExit = 'Break:exit',
                          Emphasis = 'Emphasis',
                          EmphasisExit = 'Emphasis:exit',
                          Strong = 'Strong',
                          StrongExit = 'Strong:exit',
                          Html = 'Html',
                          HtmlExit = 'Html:exit',
                          Link = 'Link',
                          LinkExit = 'Link:exit',
                          Image = 'Image',
                          ImageExit = 'Image:exit',
                          Code = 'Code',
                          CodeExit = 'Code:exit',
                          Delete = 'Delete',
                          DeleteExit = 'Delete:exit',
                          }

                            member BlockQuote

                            BlockQuote = 'BlockQuote'

                              member BlockQuoteExit

                              BlockQuoteExit = 'BlockQuote:exit'

                                member Break

                                Break = 'Break'

                                  member BreakExit

                                  BreakExit = 'Break:exit'

                                    member Code

                                    Code = 'Code'

                                      member CodeBlock

                                      CodeBlock = 'CodeBlock'

                                        member CodeBlockExit

                                        CodeBlockExit = 'CodeBlock:exit'

                                          member CodeExit

                                          CodeExit = 'Code:exit'

                                            member Comment

                                            Comment = 'Comment'

                                              member CommentExit

                                              CommentExit = 'Comment:exit'

                                                member Delete

                                                Delete = 'Delete'

                                                  member DeleteExit

                                                  DeleteExit = 'Delete:exit'

                                                    member Document

                                                    Document = 'Document'

                                                      member DocumentExit

                                                      DocumentExit = 'Document:exit'

                                                        member Emphasis

                                                        Emphasis = 'Emphasis'

                                                          member EmphasisExit

                                                          EmphasisExit = 'Emphasis:exit'

                                                            member Header

                                                            Header = 'Header'

                                                              member HeaderExit

                                                              HeaderExit = 'Header:exit'

                                                                member HorizontalRule

                                                                HorizontalRule = 'HorizontalRule'

                                                                  member HorizontalRuleExit

                                                                  HorizontalRuleExit = 'HorizontalRule:exit'

                                                                    member Html

                                                                    Html = 'Html'

                                                                      member HtmlBlock

                                                                      HtmlBlock = 'HtmlBlock'

                                                                        member HtmlBlockExit

                                                                        HtmlBlockExit = 'HtmlBlock:exit'

                                                                          member HtmlExit

                                                                          HtmlExit = 'Html:exit'

                                                                            member Image

                                                                            Image = 'Image'

                                                                              member ImageExit

                                                                              ImageExit = 'Image:exit'
                                                                                Link = 'Link'

                                                                                  member LinkExit

                                                                                  LinkExit = 'Link:exit'

                                                                                    member List

                                                                                    List = 'List'

                                                                                      member ListExit

                                                                                      ListExit = 'List:exit'

                                                                                        member ListItem

                                                                                        ListItem = 'ListItem'

                                                                                          member ListItemExit

                                                                                          ListItemExit = 'ListItem:exit'

                                                                                            member Paragraph

                                                                                            Paragraph = 'Paragraph'

                                                                                              member ParagraphExit

                                                                                              ParagraphExit = 'Paragraph:exit'

                                                                                                member ReferenceDef

                                                                                                ReferenceDef = 'ReferenceDef'
                                                                                                • Deprecated

                                                                                                member ReferenceDefExit

                                                                                                ReferenceDefExit = 'ReferenceDef:exit'
                                                                                                • Deprecated

                                                                                                member Str

                                                                                                Str = 'Str'

                                                                                                  member StrExit

                                                                                                  StrExit = 'Str:exit'

                                                                                                    member Strong

                                                                                                    Strong = 'Strong'

                                                                                                      member StrongExit

                                                                                                      StrongExit = 'Strong:exit'

                                                                                                        Type Aliases

                                                                                                        type AnyTxtNode

                                                                                                        type AnyTxtNode = TxtNode | TxtTextNode | TxtParentNode;
                                                                                                        • Any TxtNode types

                                                                                                        type TextNodeRange

                                                                                                        type TextNodeRange = [number, number];
                                                                                                        • Range start with 0

                                                                                                        type TxtNodeType

                                                                                                        type TxtNodeType = keyof typeof ASTNodeTypes | string;
                                                                                                        • Key of ASTNodeTypes or any string For example, TxtNodeType is "Document".

                                                                                                        type TypeofTxtNode

                                                                                                        type TypeofTxtNode<T extends ASTNodeTypes | string> = T extends ASTNodeTypes.Document
                                                                                                        ? TxtParentNode
                                                                                                        : T extends ASTNodeTypes.DocumentExit
                                                                                                        ? TxtParentNode
                                                                                                        : T extends ASTNodeTypes.Paragraph
                                                                                                        ? TxtParentNode
                                                                                                        : T extends ASTNodeTypes.ParagraphExit
                                                                                                        ? TxtParentNode
                                                                                                        : T extends ASTNodeTypes.BlockQuote
                                                                                                        ? TxtParentNode
                                                                                                        : T extends ASTNodeTypes.BlockQuoteExit
                                                                                                        ? TxtParentNode
                                                                                                        : T extends ASTNodeTypes.List
                                                                                                        ? TxtParentNode
                                                                                                        : T extends ASTNodeTypes.ListExit
                                                                                                        ? TxtParentNode
                                                                                                        : T extends ASTNodeTypes.ListItem
                                                                                                        ? TxtParentNode
                                                                                                        : T extends ASTNodeTypes.ListItemExit
                                                                                                        ? TxtParentNode
                                                                                                        : T extends ASTNodeTypes.Header
                                                                                                        ? TxtParentNode
                                                                                                        : T extends ASTNodeTypes.HeaderExit
                                                                                                        ? TxtParentNode
                                                                                                        : T extends ASTNodeTypes.CodeBlock
                                                                                                        ? TxtParentNode
                                                                                                        : T extends ASTNodeTypes.CodeBlockExit
                                                                                                        ? TxtParentNode
                                                                                                        : T extends ASTNodeTypes.HtmlBlock
                                                                                                        ? TxtParentNode
                                                                                                        : T extends ASTNodeTypes.HtmlBlockExit
                                                                                                        ? TxtParentNode
                                                                                                        : T extends ASTNodeTypes.Link
                                                                                                        ? TxtParentNode
                                                                                                        : T extends ASTNodeTypes.LinkExit
                                                                                                        ? TxtParentNode
                                                                                                        : T extends ASTNodeTypes.Delete
                                                                                                        ? TxtParentNode
                                                                                                        : T extends ASTNodeTypes.DeleteExit
                                                                                                        ? TxtParentNode
                                                                                                        : T extends ASTNodeTypes.Emphasis
                                                                                                        ? TxtParentNode
                                                                                                        : T extends ASTNodeTypes.EmphasisExit
                                                                                                        ? TxtParentNode
                                                                                                        : T extends ASTNodeTypes.Strong
                                                                                                        ? TxtParentNode
                                                                                                        : T extends ASTNodeTypes.StrongExit
                                                                                                        ? TxtParentNode
                                                                                                        : T extends ASTNodeTypes.Break
                                                                                                        ? TxtNode
                                                                                                        : T extends ASTNodeTypes.BreakExit
                                                                                                        ? TxtNode
                                                                                                        : T extends ASTNodeTypes.Image
                                                                                                        ? TxtNode
                                                                                                        : T extends ASTNodeTypes.ImageExit
                                                                                                        ? TxtNode
                                                                                                        : T extends ASTNodeTypes.HorizontalRule
                                                                                                        ? TxtNode
                                                                                                        : T extends ASTNodeTypes.HorizontalRuleExit
                                                                                                        ? TxtNode
                                                                                                        : T extends ASTNodeTypes.Comment
                                                                                                        ? TxtTextNode
                                                                                                        : T extends ASTNodeTypes.CommentExit
                                                                                                        ? TxtTextNode
                                                                                                        : T extends ASTNodeTypes.Str
                                                                                                        ? TxtTextNode
                                                                                                        : T extends ASTNodeTypes.StrExit
                                                                                                        ? TxtTextNode
                                                                                                        : T extends ASTNodeTypes.Code
                                                                                                        ? TxtTextNode
                                                                                                        : T extends ASTNodeTypes.CodeExit
                                                                                                        ? TxtTextNode
                                                                                                        : T extends ASTNodeTypes.Html
                                                                                                        ? TxtTextNode
                                                                                                        : T extends ASTNodeTypes.HtmlExit
                                                                                                        ? TxtTextNode
                                                                                                        : any;
                                                                                                        • Return TxtNode type of ASTNodeTypes | string

                                                                                                          Example 1

                                                                                                          ``` type NodeType = TxtNodeTypeOfNode<ASTNodeTypes.Document>;

                                                                                                        Package Files (2)

                                                                                                        Dependencies (0)

                                                                                                        No dependencies.

                                                                                                        Dev Dependencies (6)

                                                                                                        Peer Dependencies (0)

                                                                                                        No peer dependencies.

                                                                                                        Badge

                                                                                                        To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                        You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@textlint/ast-node-types.

                                                                                                        • Markdown
                                                                                                          [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@textlint/ast-node-types)
                                                                                                        • HTML
                                                                                                          <a href="https://www.jsdocs.io/package/@textlint/ast-node-types"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>