Repository navigation
Does excludeDecorators work in Source doc blocks? #36515
SummaryWe're looking to output component code both with and without decorators in an MDX file but it doesn't look like Happy to put in a feature request or a bug report if this hasn't been added or isn't working. Additional information
Create a reproduction |
Replies: 1 comment 1 reply
|
context.parameters.docs.source.excludeDecoratorsThe working configuration is therefore a story parameter: export const PrimaryWithoutDecorators = {
...Primary,
parameters: {
docs: {
source: {
excludeDecorators: true,
},
},
},
};Then reference both variants: <Source of={ButtonStories.Primary} />
<Source of={ButtonStories.PrimaryWithoutDecorators} />Because the value comes from the story context, it cannot currently vary between two The HTML renderer reads the parameter here. The documentation describing |
excludeDecoratorscurrently does not work as a per-<Source>prop, so your reproduction matches the implementation rather than an MDX mistake.SourcePropsdoes not declare, consume, or forwardexcludeDecorators. For the HTML renderer, source generation only checks:The working configuration is therefore a story parameter:
Then reference both variants:
Because the value comes from the story contex…