Utilities for creation & injection of AST nodes #38
-
ProblemMany utilities are listed for search, filter, parse, etc, but I see none for creation and node injection. DiscussionWhat approaches do you use? Plain old javascript? I was hoping for something like I did consult the documentation site and various lists of utilities pre post :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Personally I tend to use unist-util-visit and unist-util-visit-parents the most, in both cases, mutating a Another approach, specifically for building nodes is to use JSX syntax.
More DOM style APIs could be good contributions to unist/syntax-tree! Are you interested in creating some? |
Beta Was this translation helpful? Give feedback.
Personally I tend to use unist-util-visit and unist-util-visit-parents the most, in both cases, mutating a
node
will modify the original AST.For particularly complex node access, I may use unist-util-select to be able to leverage CSS-like selectors.
Another approach, specifically for building nodes is to use JSX syntax.
Which is built into xastscript and hastscript (in a yet to be released version). it can also be applied to other AST builders.
More DOM style APIs could be good contributions to unist/syntax-tree! Are you interested in creating some?
Some related ideas could include building out…