-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Forwarding options to remarkPlugins/rehypePlugins can break them #575
Comments
Funky, yeah I’m wondering what the reason is. Seems to be there since the beginning: |
Yeah, I doubt any reason can justify this behavior, so I'll prepare a PR just in case. |
I’m pretty sure a PR is good, but wondering what @johno thinks. This also could be, very very theoretically, breaking. But it’s much more likely that it breaks plugins like you describe. So I’d say this shouldn’t need a major semver release. |
Yeah this is really an artifact of a quick hack that was never cleaned up. I think this is okay without a major since it's likely breaking plugins, but not 100% sure there. |
I suspect there is a teeny tiny extremely slim chance someone depends and we’d break something if we patch it up. If we do a major (or wait for one) the chance of someone being on I also think @silvenon has a good enough understanding of remark and MDX that he can figure out what happened rather easily, but I don’t think many other persons using MDX can figure out what’s failing, resulting in a pretty bad debugging experience. Therefore I propose patching this up instead of a major release. We can add a note about this in releases though. |
Subject of the issue
Currently
@mdx-js/mdx
forwards its options to every plugin inremarkPlugins
andrehypePlugins
, which can easily lead to some of them breaking. Is there a specific reason why we're doing this? If it's a behavior left over from something else, I can remove it.Your environment
Steps to reproduce
Expected behaviour
remark-frontmatter shouldn't be getting unexpected options.
Actual behaviour
Options from the
mdx()
call get forwarded to remark-frontmatter, which thinks we're passing the definition for detecting frontmatter, but the shape of the object doesn't satisfy its criteria so it crashes.Temporary workaround
Passing
undefined
as an option to all plugins, which results in default, i.e. expected behavior.The text was updated successfully, but these errors were encountered: