Skip to content

Storybook MDX file does not display source #24848

Answered by konsalex
konsalex asked this question in Help
Discussion options

You must be logged in to vote

@integrayshaun thanks for the guidance. Ended up creating a pattern which is more maintainable as the code will live only in one place, and not manually pasted as a string.

story/
├── StoryBlock // The actual code that will run the hook example
├── hook.stories.tsx // The CSF compatible file
└── hook.mdx // The MDX doc of the hook, utilising Vite's `?raw` import flag

Example for future reference from folks:
https://stackblitz.com/edit/react-hook-story-cigb35?file=src%2Fhooks%2FuseRenderCount%2FStoryCode.tsx

Replies: 1 comment 12 replies

Comment options

You must be logged in to vote
12 replies
@ShaunEvening
Comment options

@konsalex
Comment options

@ShaunEvening
Comment options

@konsalex
Comment options

Answer selected by konsalex
@joevaugh4n
Comment options

@konsalex
Comment options

@konsalex
Comment options

@dpavloff
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
5 participants