textlint / textlint

The pluggable natural language linter for text and markdown.
https://textlint.github.io/
MIT License
2.83k stars 153 forks source link

Add individual Node type for @textlint/ast-node-types #764

Closed azu closed 1 year ago

azu commented 3 years ago

We want to add individual Node type like Str, Code to @textlint/ast-node-types

Currently, @textlint/ast-node-types has three abustract types:

We need to add TxtStrNode etc...

AST Node Type

Type name Node type Description
ASTNodeTypes.Document TxtParentNode Root Node
ASTNodeTypes.Paragraph TxtParentNode Paragraph Node
ASTNodeTypes.BlockQuote TxtParentNode > Block Quote Node
ASTNodeTypes.List TxtParentNode List Node
ASTNodeTypes.ListItem TxtParentNode List (each) item Node
ASTNodeTypes.Header TxtParentNode # Header Node
ASTNodeTypes.CodeBlock TxtParentNode Code Block Node
ASTNodeTypes.HtmlBlock TxtParentNode HTML Block Node
ASTNodeTypes.Link TxtParentNode Link Node
ASTNodeTypes.Delete TxtParentNode Delete Node(~Str~)
ASTNodeTypes.Emphasis TxtParentNode Emphasis(*Str*)
ASTNodeTypes.Strong TxtParentNode Strong Node(**Str**)
ASTNodeTypes.Break TxtNode Hard Break Node(Str<space><space>)
ASTNodeTypes.Image TxtNode Image Node
ASTNodeTypes.HorizontalRule TxtNode Horizontal Node(---)
ASTNodeTypes.Comment TxtTextNode Comment Node
ASTNodeTypes.Str TxtTextNode Str Node
ASTNodeTypes.Code TxtTextNode Inline Code Node
ASTNodeTypes.Html TxtTextNode Inline HTML Node

Related #740

azu commented 1 year ago

Related #944

azu commented 1 year ago

We need to rethink about TxtNode

azu commented 1 year ago

TxtNode TxtNode is an abstract node. https://textlint.github.io/docs/txtnode.html

At the very least, it is strange that the <br/> is a TxtNode. It is not abstract. It is self closed node