-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Codemod: convert mdx to module format #7419
Conversation
This pull request is automatically deployed with Now. Latest deployment for this branch: https://monorepo-git-7101-convert-mdx-to-module.storybook.now.sh |
Automention: Hey @Keraito @elevatebart @JeroenReumkens, you've been tagged! Can you give a hand here? |
import { Meta, Story } from '@storybook/addon-docs/blocks'; | ||
|
||
<Meta title='Button' /> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any markdown here just gets completely dropped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now, yes. PR's welcome 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm.. do you think this is useful if we do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely. We're going from a format that supports mixtures of longform documentation and code to one that does not. This completely solves the tedious task of translation in an automated fashion, and for now users will have to figure out themselves how they want to encode that documentation.
If we ever have a recommended way to encode longform docs in module format, we can try to encode that in the codemod.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought you could put markdown in the module format somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a prescription for that. Some users will put it in docgen comments, others in strings, others in .md
files that get loaded in. When somebody has a good solution they want to push, they can upgrade this codemod accordingly.
I personally think people should be using MDX for longform docs and not module format, and the purpose of this PR is to help people who try it and want to go back for whatever reason.
Issue: #7101
Builds on #7418, merge that first before reviewing
What I did
convert-mdx-to-module
codemod + test casesHow to test
Unit:
End-to-end: