@textlint/ast-node-types

  • Version 16.1.3
  • Published
  • 52.2 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 TxtBlockQuoteNode

interface TxtBlockQuoteNode extends TxtParentNode {}
  • A quotation of blocks.

property children

readonly children: readonly BlockContent[];

    property type

    readonly type: 'BlockQuote';

      interface TxtBreakNode

      interface TxtBreakNode extends TxtNode {}
      • A hard line break.

      property type

      readonly type: 'Break';

        interface TxtCodeBlockNode

        interface TxtCodeBlockNode extends TxtTextNode {}
        • A block of code. value is the code.

        property lang

        readonly lang?: string | null | undefined;
        • Language of the code.

        property meta

        readonly meta?: string | null | undefined;
        • Additional information that follows the language.

        property type

        readonly type: 'CodeBlock';

          interface TxtCodeNode

          interface TxtCodeNode extends TxtTextNode {}
          • Inline code. value is the code.

          property type

          readonly type: 'Code';

            interface TxtCommentNode

            interface TxtCommentNode extends TxtTextNode {}
            • A comment of the format. value is the content of the comment.

            property type

            readonly type: 'Comment';

              interface TxtDefinitionNode

              interface TxtDefinitionNode extends TxtNode, TxtResource, TxtReference {}
              • A definition that a reference points to.

              property type

              readonly type: 'Definition';

                interface TxtDeleteNode

                interface TxtDeleteNode extends TxtParentNode {}
                • Deleted text.

                property children

                readonly children: readonly PhrasingContent[];

                  property type

                  readonly type: 'Delete';

                    interface TxtDocumentNode

                    interface TxtDocumentNode extends TxtParentNode {}
                    • The whole document. It is the root of the AST.

                    property type

                    readonly type: 'Document';

                      interface TxtEmphasisNode

                      interface TxtEmphasisNode extends TxtParentNode {}
                      • Emphasis.

                      property children

                      readonly children: readonly PhrasingContent[];

                        property type

                        readonly type: 'Emphasis';

                          interface TxtHeaderNode

                          interface TxtHeaderNode extends TxtParentNode {}
                          • A heading.

                          property children

                          readonly children: readonly PhrasingContent[];

                            property depth

                            readonly depth: 1 | 2 | 3 | 4 | 5 | 6;
                            • Level of the heading. 1 is the top level.

                            property type

                            readonly type: 'Header';

                              interface TxtHorizontalRuleNode

                              interface TxtHorizontalRuleNode extends TxtNode {}
                              • A thematic break.

                              property type

                              readonly type: 'HorizontalRule';

                                interface TxtHtmlNode

                                interface TxtHtmlNode extends TxtTextNode {}
                                • Raw HTML, as a block or inline. value is the HTML.

                                property type

                                readonly type: 'Html';

                                  interface TxtImageNode

                                  interface TxtImageNode extends TxtNode, TxtResource, TxtAlternative {}
                                  • An image.

                                  property type

                                  readonly type: 'Image';

                                    interface TxtImageReferenceNode

                                    interface TxtImageReferenceNode extends TxtNode, TxtAlternative, TxtReference {}
                                    • An image that points to a Definition.

                                    property referenceType

                                    readonly referenceType: ReferenceType;
                                    • How the reference is written.

                                    property type

                                    readonly type: 'ImageReference';

                                      interface TxtLinkNode

                                      interface TxtLinkNode extends TxtParentNode, TxtResource {}
                                      • A link.

                                      property children

                                      readonly children: readonly StaticPhrasingContent[];

                                        property type

                                        readonly type: 'Link';

                                          interface TxtLinkReferenceNode

                                          interface TxtLinkReferenceNode extends TxtParentNode, TxtReference {}
                                          • A link that points to a Definition.

                                          property children

                                          readonly children: readonly StaticPhrasingContent[];

                                            property referenceType

                                            readonly referenceType: ReferenceType;
                                            • How the reference is written.

                                            property type

                                            readonly type: 'LinkReference';

                                              interface TxtListItemNode

                                              interface TxtListItemNode extends TxtParentNode {}
                                              • An item of a list.

                                              property checked

                                              readonly checked?: boolean | null | undefined;
                                              • true or false for a task list item. null or absent for other items.

                                              property children

                                              readonly children: readonly BlockContent[];

                                                property spread

                                                readonly spread?: boolean | null | undefined;
                                                • Whether the item contains blocks separated by blank lines.

                                                property type

                                                readonly type: 'ListItem';

                                                  interface TxtListNode

                                                  interface TxtListNode extends TxtParentNode {}
                                                  • A list. Its children are ListItem.

                                                  property children

                                                  readonly children: readonly ListContent[];

                                                    property ordered

                                                    readonly ordered?: boolean | null | undefined;
                                                    • Whether the items are ordered.

                                                    property spread

                                                    readonly spread?: boolean | null | undefined;
                                                    • Whether any of the items are separated by blank lines.

                                                    property start

                                                    readonly start?: number | null | undefined;
                                                    • Number of the first item of an ordered list.

                                                    property type

                                                    readonly type: 'List';

                                                      interface TxtNode

                                                      interface TxtNode {}
                                                      • TxtNode is abstract interface of AST Node. Probably, Real TxtNode implementation has more properties.

                                                        These type definitions are the definition of the generic nodes of TxtAST. A property marked as optional with ? may be absent, undefined, or null. Every other property is required in every format.

                                                      property loc

                                                      readonly loc: TxtNodeLocation;

                                                        property parent

                                                        readonly parent?: TxtParentNode;

                                                          property range

                                                          readonly range: TxtNodeRange;

                                                            property raw

                                                            readonly raw: string;
                                                            • Source text of the node. It is the document text from range[0] to range[1].

                                                            property type

                                                            readonly type: TxtNodeType;
                                                            • Name of the node type. A generic node type is PascalCase. A node type that a format adds starts with a lowercase letter.

                                                            interface TxtParagraphNode

                                                            interface TxtParagraphNode extends TxtParentNode {}
                                                            • A paragraph.

                                                            property children

                                                            readonly children: readonly PhrasingContent[];

                                                              property type

                                                              readonly type: 'Paragraph';

                                                                interface TxtParentNode

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

                                                                property children

                                                                readonly children: readonly Content[];
                                                                • Child nodes in the source order. It may be empty.

                                                                interface TxtStrNode

                                                                interface TxtStrNode extends TxtTextNode {}
                                                                • Prose. value is the text that rules check. Markup becomes other nodes, and a parser does not split Str into sentences or words.

                                                                property type

                                                                readonly type: 'Str';

                                                                  interface TxtStrongNode

                                                                  interface TxtStrongNode extends TxtParentNode {}
                                                                  • Strong emphasis.

                                                                  property children

                                                                  readonly children: readonly PhrasingContent[];

                                                                    property type

                                                                    readonly type: 'Strong';

                                                                      interface TxtTableCellNode

                                                                      interface TxtTableCellNode extends TxtParentNode {}
                                                                      • A cell of a table.

                                                                      property children

                                                                      readonly children: readonly PhrasingContent[];

                                                                        property type

                                                                        readonly type: 'TableCell';

                                                                          interface TxtTableNode

                                                                          interface TxtTableNode extends TxtParentNode {}
                                                                          • A table. Its children are TableRow.

                                                                          property align

                                                                          readonly align?: readonly AlignType[] | null | undefined;
                                                                          • Alignment of each column.

                                                                          property children

                                                                          readonly children: readonly TableContent[];

                                                                            property type

                                                                            readonly type: 'Table';

                                                                              interface TxtTableRowNode

                                                                              interface TxtTableRowNode extends TxtParentNode {}
                                                                              • A row of a table. Its children are TableCell.

                                                                              property children

                                                                              readonly children: readonly RowContent[];

                                                                                property type

                                                                                readonly type: 'TableRow';

                                                                                  interface TxtTextNode

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

                                                                                  property value

                                                                                  readonly value: string;
                                                                                  • Content of the node without the markup, so it may differ from raw. Each text node type states what value holds.

                                                                                  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',
                                                                                  LinkReference = 'LinkReference',
                                                                                  LinkReferenceExit = 'LinkReference:exit',
                                                                                  Image = 'Image',
                                                                                  ImageExit = 'Image:exit',
                                                                                  ImageReference = 'ImageReference',
                                                                                  ImageReferenceExit = 'ImageReference:exit',
                                                                                  Definition = 'Definition',
                                                                                  DefinitionExit = 'Definition:exit',
                                                                                  Code = 'Code',
                                                                                  CodeExit = 'Code:exit',
                                                                                  Delete = 'Delete',
                                                                                  DeleteExit = 'Delete:exit',
                                                                                  Table = 'Table',
                                                                                  TableExit = 'Table:exit',
                                                                                  TableRow = 'TableRow',
                                                                                  TableRowExit = 'TableRow:exit',
                                                                                  TableCell = 'TableCell',
                                                                                  TableCellExit = 'TableCell:exit',
                                                                                  }
                                                                                  • ASTNodeTypes is a list of ASTNode type.

                                                                                  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 Definition

                                                                                                      Definition = 'Definition'

                                                                                                        member DefinitionExit

                                                                                                        DefinitionExit = 'Definition: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'
                                                                                                                                • Deprecated

                                                                                                                                  use Html instead of it

                                                                                                                                member HtmlBlockExit

                                                                                                                                HtmlBlockExit = 'HtmlBlock:exit'

                                                                                                                                  member HtmlExit

                                                                                                                                  HtmlExit = 'Html:exit'

                                                                                                                                    member Image

                                                                                                                                    Image = 'Image'

                                                                                                                                      member ImageExit

                                                                                                                                      ImageExit = 'Image:exit'

                                                                                                                                        member ImageReference

                                                                                                                                        ImageReference = 'ImageReference'

                                                                                                                                          member ImageReferenceExit

                                                                                                                                          ImageReferenceExit = 'ImageReference:exit'
                                                                                                                                            Link = 'Link'

                                                                                                                                              member LinkExit

                                                                                                                                              LinkExit = 'Link:exit'

                                                                                                                                                member LinkReference

                                                                                                                                                LinkReference = 'LinkReference'

                                                                                                                                                  member LinkReferenceExit

                                                                                                                                                  LinkReferenceExit = 'LinkReference: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'

                                                                                                                                                                        member Table

                                                                                                                                                                        Table = 'Table'

                                                                                                                                                                          member TableCell

                                                                                                                                                                          TableCell = 'TableCell'

                                                                                                                                                                            member TableCellExit

                                                                                                                                                                            TableCellExit = 'TableCell:exit'

                                                                                                                                                                              member TableExit

                                                                                                                                                                              TableExit = 'Table:exit'

                                                                                                                                                                                member TableRow

                                                                                                                                                                                TableRow = 'TableRow'

                                                                                                                                                                                  member TableRowExit

                                                                                                                                                                                  TableRowExit = 'TableRow:exit'

                                                                                                                                                                                    Type Aliases

                                                                                                                                                                                    type AnyTxtNode

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

                                                                                                                                                                                    type TxtNodeLocation

                                                                                                                                                                                    type TxtNodeLocation = {
                                                                                                                                                                                    readonly start: TxtNodePosition;
                                                                                                                                                                                    readonly end: TxtNodePosition;
                                                                                                                                                                                    };
                                                                                                                                                                                    • Location. start is the position of range[0], and end is the position of range[1].

                                                                                                                                                                                    type TxtNodePosition

                                                                                                                                                                                    type TxtNodePosition = {
                                                                                                                                                                                    readonly line: number;
                                                                                                                                                                                    readonly column: number;
                                                                                                                                                                                    };
                                                                                                                                                                                    • A position in the document text. line starts with 1, and column starts with 0 and counts UTF-16 code units. The character after a line ending is at column 0 of the next line. This is for compatibility with JavaScript AST. https://gist.github.com/azu/8866b2cb9b7a933e01fe

                                                                                                                                                                                    type TxtNodeRange

                                                                                                                                                                                    type TxtNodeRange = readonly [startIndex: number, endIndex: number];
                                                                                                                                                                                    • Range is a pair of offsets in the document text. startIndex is inclusive and endIndex is exclusive. Offsets start with 0 and count UTF-16 code units.

                                                                                                                                                                                    type TxtNodeType

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

                                                                                                                                                                                    type TypeofTxtNode

                                                                                                                                                                                    type TypeofTxtNode<T extends ASTNodeTypes | string> = T extends keyof TxtNodeTypeMap
                                                                                                                                                                                    ? TxtNodeTypeMap[T]
                                                                                                                                                                                    : AnyTxtNode;
                                                                                                                                                                                    • Type utility for TxtNodeType Return TxtNode interface for the TxtNodeType

                                                                                                                                                                                      Example 1

                                                                                                                                                                                      type NodeType = TypeofTxtNode<ASTNodeTypes.Document>;

                                                                                                                                                                                    Package Files (4)

                                                                                                                                                                                    Dependencies (0)

                                                                                                                                                                                    No dependencies.

                                                                                                                                                                                    Dev Dependencies (4)

                                                                                                                                                                                    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>