-
-
Notifications
You must be signed in to change notification settings - Fork 9.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
[Bug]: Components as children of Canvas
has Show Code without line breaks
#21795
Comments
I think the preferred approach is that you put those examples in stories and we will provide ways to designate stories as "docs only" in 7.1. In the meantime, I'm not sure the best way to work around this. @JReinhold can you please help out here? |
Canvas
has Show Code without line breaks
A little background on the problem I was trying to solve... take a look at the DIAGRAMS section on this storybook... If you expand Nodes/Card, Nodes/Shape, Edges, and Edges/Marker, there are 28 stories generated by data using storiesOf() in a single stories.ts file. None of these stories provide real value other than showing an example without code. Instead of creating 28 CSFs, I'd like to have 4 x MDXs show in the navigation: Cards, Shapes, Edges, Markers and have the variations displayed in Canvas nodes on each of those MDXs with the little Source code tab for each canvas mixed with a little explanatory text at the top. Moving to 4 x MDXs is a 400% increase in the number of files from the current approach but having the ability to display the source for each example makes it more valuable. But moving to 28 x CSFs plus 4 x MDXs just for the DIAGRAMS section is problematic. Also, we still have all the other stories in UTILITY, SIMPLE CHARTS, and COMPLEX CHARTS sections that are generated with a single stories.ts via storiesOf() and a big array that would need to be created as separate files times the number of environments (5): Vanilla JavaScript (storybook html), Angular, React, Svelte and Vue. Hope that perspective helps. |
This is a nasty bug produced by how the output of MDX2 interacts with Reproduced here: https://stackblitz.com/edit/github-nghoh2?file=src/stories/broken-source.stories.mdxI believe the broken source that is generated, is the JSX that the MDX2 compiler actually outputs from the file. A hint to that is the extra I'm unsure what to do about this, other than giving The reproduction also shows that if you try to manually specify the Finally, the reproduction shows that manually specifying So I don't have a good workaround for you yet. |
@JReinhold - thanks for investigating this one. The master branch for @carbon/charts uses Storybook 5.3.12. I've been working hard to migrate things forward to prepare for 7.0 but the sticking point is that I would have to convert all 895 stories that are data-generated (5 environments, 179 stories for each - at least) via storiesOf() if I want to eliminate this setting in my main.ts... features: {
storyStoreV7: false
} So I've been converting what I can to MDX to take advantage of the markup capabilities but that still leaves the other 895 stories. |
@JReinhold I don't consider that a bug. The |
Might not be following. Was trying to create documentation page not connected to a story primarily to show source code with examples and some explanation. Am I overriding something? |
@nstuyvesant Sorry for the confusion, was just comment on one part of @JReinhold 's comment above. Updated my comment. Still thinking about the proper solution to your problem! |
I'll dig into this when I have time. Getting the raw source was the original intent of |
Ah ok - I misunderstood. Thanks for the clarification. |
@nstuyvesant this is super useful. can you please add it as a comment on #9828 which is the main issue for migrating off of |
@shilman - you got it. I just posted something. |
Hi @nstuyvesant so sorry this fell off my radar and I'm just getting back to it. We're no longer maintaining the old MDX behavior at this point, so I think your best bet if you want to keep the source formatting is to define a story, import it into MDX, and then set the Please let me know if you have any questions! |
Thanks @shilman |
Describe the bug
Perhaps this is my misunderstanding or I need a property on the Canvas but I have a number of examples in an MDX like this where I do not want to generate a story...
When I hit the "Show Code" button on the lower right, it displays this as a single row with the newlines in handlebars instead of the way I entered it in the MDX...
I have to use the prior version of MDX because my storybook still has other stories based on storiesOf(). So I have this property set in my .storybook/main.ts...
To Reproduce
Take example above
System
Additional context
No response
The text was updated successfully, but these errors were encountered: