We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It'd be nice to have the option to strip Storybook's wrapper when used as a global decorator. It does work well when invoked directly by each story.
preview.ts:
preview.ts
import { addDecorator } from '@storybook/react'; import { jsxDecorator } from 'storybook-addon-jsx'; addDecorator(jsxDecorator);
MyComponent.stories.ts:
MyComponent.stories.ts
import { Meta } from '@storybook/react/types-6-0'; import React, { ReactElement } from 'react'; import { MyComponent, MyComponentProps } from '../../src/components'; const meta: Meta = { component: MyComponent, title: 'Components/MyComponent', }; const Story = (args: MyComponentProps): ReactElement => <MyComponent {...args} />; export { meta as default, Story };
addon-jsx output:
addon-jsx
<ReadmeContent DocPreview={undefined} FooterPreview={undefined} HeaderPreview={undefined} StoryPreview={undefined} codeTheme="github" layout={[ { content: <><MyComponent /></>, type: 'STORY' } ]} theme={{}} types={[ 'MD', 'STORY', 'STORY_SOURCE', 'PROPS', 'FOOTER_MD', 'HEADER_MD' ]} />
The text was updated successfully, but these errors were encountered:
Partial solution:
const parameters = { jsx: { onBeforeRender: (domStr: string) => /content: <>(.*)<\/>/.exec(domStr)?.[1] || domStr, }, };
We lose some formatting still though 😞 ie, maxInlineAttributesLineLength isn't respected anymore.
maxInlineAttributesLineLength
Sorry, something went wrong.
Where is ReadmeContent coming from?
ReadmeContent
No branches or pull requests
Describe the bug
It'd be nice to have the option to strip Storybook's wrapper when used as a global decorator.
It does work well when invoked directly by each story.
Steps to reproduce the behavior
preview.ts
:MyComponent.stories.ts
:addon-jsx
output:The text was updated successfully, but these errors were encountered: