-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
MDX story snippets #15
Comments
Hi @zeorin! I never tried it with MDX, but it might work if we add
You can give it a try by manually changing the file in |
I tried that already, actually:
|
Seems like it might require more investigation to try and support mdx based stories. In the meantime, is there any way to filter out the stories that use |
I'm pretty sure the One thing I noticed is that they mention that in order for that code to work with MDX based stories, you have to apply this transform that they provide for Jest: https://github.com/storybookjs/storybook/blob/next/addons/storyshots/storyshots-core/README.md#configure-jest-for-mdx-docs-add-on-stories. It basically boils down to running their MDX compiler plugin like so: This makes sense in a Jest environment, but I'm not quite sure how you would apply that same idea here |
Indeed, the script is based on StoryShots addon, with Jest dependencies removed. I'm not sure we can do the same here though, as the Storybook client API doesn't seem to support transformers—if it had, the Jest setup would not be needed in the first place. Haven't had time to look into this yet, but if anyone wants to give it a try, a PR would be very welcome 🙂 |
@rbardini I can give it a go. The approach I'm going to try is described here: mdx-js/mdx#171 (comment). I'm going to hijack Node's If someone thinks of a better solution, please do share! 😄 |
Ran out of time today, but I managed to get something kinda working: master...umar-ahmed:master The main issue I am seeing is that for React elements, it converts it to I'm assuming that's to support changing the actual element used at runtime, but not sure how to get it to actually use a normal |
That looks very promising, @umar-ahmed! Nice work 👍 Don't know how to get rid of the |
I'm using the snippet generation in my project, and it works great. But I'd like to be able to have MDX stories be generated as snippets, too.
The text was updated successfully, but these errors were encountered: