mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-20 05:02:37 +08:00
Addon-docs: Fix custom source manual override
This commit is contained in:
parent
eac63d4178
commit
c79904302b
@ -41,7 +41,7 @@ export const getSourceProps = (
|
||||
source = targetIds
|
||||
.map((sourceId) => {
|
||||
const data = storyStore.fromId(sourceId);
|
||||
const enhanced = data && enhanceSource(data);
|
||||
const enhanced = data && (enhanceSource(data) || data.parameters);
|
||||
return enhanced?.docs?.source?.code || '';
|
||||
})
|
||||
.join('\n\n');
|
||||
|
@ -28,11 +28,23 @@ How you like them apples?!
|
||||
## Custom source
|
||||
|
||||
<Preview>
|
||||
<Story name="custom source" height="100px" parameters={{ docs: { source: { code: 'hello' }}}}>
|
||||
<Story name="custom source" height="100px" parameters={{ docs: { source: { code: 'hello' } } }}>
|
||||
{'<h1>Custom source</h1>'}
|
||||
</Story>
|
||||
</Preview>
|
||||
|
||||
## Transformed source
|
||||
|
||||
<Preview>
|
||||
<Story
|
||||
name="transformed source"
|
||||
height="100px"
|
||||
parameters={{ docs: { transformSource: (src) => `transformed: ${src}` } }}
|
||||
>
|
||||
{'<h1>Some source</h1>'}
|
||||
</Story>
|
||||
</Preview>
|
||||
|
||||
## Story reference
|
||||
|
||||
You can also reference an existing story from within your MDX file.
|
||||
|
Loading…
x
Reference in New Issue
Block a user