Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create programatic properties via plugin #169

Open
motleydev opened this issue May 9, 2022 · 1 comment
Open

How to create programatic properties via plugin #169

motleydev opened this issue May 9, 2022 · 1 comment

Comments

@motleydev
Copy link

  • mdx-bundler version: latest
  • node version: 17.x.x
  • npm version:

Relevant code or config

rehypePlugins: [rehypeSlug, rehypeAutolinkHeadings, searchMeta],

What you did / Problem description:
I've written a custom plugin that extracts unique words from paragraph tags and I'd like to pass it programmatically to the output. I can add it to the vfile's data prop, but I'm not sure where this bundler is trying to pass content through to the final shape of the flattened _raw, frontmatter fields and code output.

Is there plugin I could reference for programmatic frontmatter?

@stefanprobst
Copy link
Contributor

it is not possible to pass vfile.data from a unified pipeline with @mdx-js/esbuild (see mdx-js/mdx#2055). however, you could use estree-util-value-to-estree to create a named export for the data (see e.g. https://github.com/stefanprobst/rehype-extract-toc/blob/main/src/mdx.js).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants