-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Support Storybook's Component Story Format #1497
Comments
Supporting MDX (and especially storybook format) is a great idea. It could bridge the divide between the two communities. MDX holds one big advantage over pure I prefer to use pure markdown for now as the source code of examples remains visible in GitHub renderings of the With MDX you get weird unclean JSX structures like in storybooks example here |
Yeah, MDX might be an option but I think it's much more difficult to do than especially the second option here. |
It feels easy to parse CSF using babel and extract the source code of examples from it. I think we could make a separate package that allows referencing CSF stories in styleguidist. I would probably see a format like this one. Though, I am struggling to see a scenario where I would use it. ``` javascript {"story": {"file": "./MyButton.stories.js", "name": "text"}}
``` |
I don't even think we need babel for this, just Acorn to locate positions of the code. Similar to how we transpile imports. And the API — I was thinking about something like that too. |
Acorn is what I meant when I said babel. They kind of conflate in my mind (babel parser ~ acorn). Regarding the API, in vue-styleguidist, I used another syntax: [import](./myExample.vue) documented here It has a considerable dev experience advantage, which is to allow navigation to the said file in vscode. |
With #1712 we'll be able to load CSF stories using a React component, instead of inventing our own syntax. |
Component Story Format (CSF) is a new format that doesn't call Storybook API directly, meaning it can be used not just in Storybook. By supporting CSF we can allow teams to use Storybook for component development, visual and end-to-end testing, and use Styleguidist to generate beautiful documentation.
It looks like this:
I see two ways of doing it:
We can implement it by first adding an internal Styleguidist format that will be used on the frontend, the current Markdown format and CSF will be converted to this format. I had this idea back in 2017, and this may open other possibilities.
Keep documentation in Markdown but reference stories to load source code from them, similar to loading source code from files.
action
s. We can probably substitute it with our own implementation.Only needed for the first option:
The text was updated successfully, but these errors were encountered: