Skip to content

unist-util-remove to remove node #70

Answered by wooorm
shtse8 asked this question in Q&A
Discussion options

You must be logged in to vote

You’re comparing the internal code of remove to the code you write with visit, which are not equal.
The code you write for remove would be 'emphasis', to remove all emphasis.
The code in visit is pretty complex.


I recommend using unist-util-visit because it’s very powerful and supports different cases: adding, removing, replacing, everything.
Importantly, it allow you to do different things in one “walk of the tree”.
With remove, if you also want to do other things, you need to walk the tree multiple times.
That’s typically the slowest thing: walking the tree many times.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by shtse8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants