Skip to content

Passing information between transformers? #100

Answered by ChristianMurphy
emmerich asked this question in Q&A
Discussion options

You must be logged in to vote

I want to modify remarkRehype so that, when it encounters an html node, it sets a "flag" on the processor which says "I've seen an HTML node, we need to run rehypeRaw". If the flag is not set, I skip rehypeRaw.

What are you trying to achieve here? This feels like an XY problem.
rehypeRaw scans for raw nodes, if it doesn't find any, then it doesn't do anything.
My guess is you are looking for a performance boost? If so, this likely wouldn't achieve your goal, skipping a scan here would have a negligible different on performance.

Passing information between transformers?

Unified uses the data attribute to pass around metadata.
This can be done at a file level https://github.com/vfile/vf…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@emmerich
Comment options

@wooorm
Comment options

@ChristianMurphy
Comment options

@wooorm
Comment options

@emmerich
Comment options

Answer selected by emmerich
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
🏁 area/perf This affects performance 🏡 area/internal This affects the hidden internals
3 participants