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

Export complete MDX unified processor #1018

Merged
merged 1 commit into from
Apr 21, 2020
Merged

Conversation

silvenon
Copy link
Contributor

This will allow advanced usage besides just compiling MDX string to JSX, like providing a vfile and attaching various data to it via remark and rehype plugins.

@silvenon silvenon added 🗄 area/interface This affects the public interface 👶 semver/patch This is a backwards-compatible fix labels Apr 19, 2020
@silvenon silvenon requested a review from johno April 19, 2020 10:22
@vercel
Copy link

vercel bot commented Apr 19, 2020

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/mdx/mdx/j424x7or6
✅ Preview: https://mdx-git-export-full-compiler.mdx.now.sh

@silvenon
Copy link
Contributor Author

silvenon commented Apr 19, 2020

My use case: I'm extracting various metadata from MDX files, like YAML frontmatter, in Next.js getStaticProps so I can generate my blog posts using dynamic routes.

Adding .mdx files directly to pages directory just doesn't give me enough control, this brings me a bit closer.

@silvenon silvenon removed the 👶 semver/patch This is a backwards-compatible fix label Apr 19, 2020
Copy link
Member

@wooorm wooorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Not necessarily for you/now, but maybe a good idea to add docs for these things?

@wooorm
Copy link
Member

wooorm commented Apr 19, 2020

Btw, what are you missing if you do: unified().use(remarkParse).use(remarkMdx)?

@vercel vercel bot temporarily deployed to Preview April 19, 2020 11:06 Inactive
@vercel vercel bot temporarily deployed to Preview April 19, 2020 11:11 Inactive
@silvenon
Copy link
Contributor Author

Nice! Not necessarily for you/now, but maybe a good idea to add docs for these things?

Done!

Btw, what are you missing if you do: unified().use(remarkParse).use(remarkMdx)?

  • I can't call .process() because I don't have a compiler, so I have to awkwardly execute phases parse and run
  • MDX adds remark-squeeze-paragraphs and md-ast-to-mdx-ast.js before adding remark plugins, so it's not the same
  • I can't use rehype plugins (not that I need to, currently)
  • having this abstraction would generally make me less anxious about whether I'm doing it right

@silvenon silvenon requested a review from wooorm April 19, 2020 11:31
This will allow advanced usage besides just compiling MDX string to JSX,
like providing a vfile and attaching various data to it via remark and
rehype plugins.
@vercel vercel bot temporarily deployed to Preview April 19, 2020 14:52 Inactive
@silvenon
Copy link
Contributor Author

I'll assume that I'm free to merge this 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🗄 area/interface This affects the public interface
Development

Successfully merging this pull request may close these issues.

None yet

2 participants