Skip to content

How to select html elements inside markdown using unist-util-select? #116

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

You must be logged in to vote

Don’t use select. It is likely slower than the better alternative. And the alternative makes your problem trivial to solve: https://github.com/syntax-tree/unist-util-select#when-should-i-use-this.

import {visit} from 'unist-util-visit'

visit(tree, function (node) {
  if (node.type === 'mdxJsxFlowElement' && /* put your extra conditions here */) {
  }
})

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@iamzee
Comment options

@wooorm
Comment options

@iamzee
Comment options

@wooorm
Comment options

Answer selected by ChristianMurphy
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