Open kasparsuvi1 opened 6 months ago
@shilman was this supposed to work? if not, i think we should update the docs.
This worked prior to the v7 changes. I'll delete the docs.
Sorry did not understand should it work or it is not meant to work this way? When not, is there any good solutions to not show toc for .mdx stories?
My workaround for disabling TOC currently is to have this global CSS:
.sbdocs-wrapper:has(#disable-toc) > .sbdocs + div {
display: none;
}
And then have <Unstyled id="disable-toc">
as I'm wrapping all pages with Unstyled.
But I would greatly prefer that <Meta title="" parameters={{ docs: { toc: false } }} />
would work.
And this of course does not help anyone who wants to control the heading selectors.
I am also facing a similar issue, except unfortunately I can only define the TOC config globally. When I try an configure the TOC in Meta
in the .mdx docs file or in the .tsx story file it is like the config is ignored and all pages use the default TOC config 🤔 .
So for Accordion
(bellow) the TOC is still generated even though it is set to false. And if I try any other configuration it is still not picked up by the Accordion component.
preview.tsx
;
const preview: Preview = {
parameters: {
docs: {
toc: {
headingSelector: 'h3, h4',
ignoreSelector: '.docs-story *',
},
},
},
};
export default preview;
Accordion.stories.tsx
;
const meta = {
title: 'Components/Accordion',
component: Accordion,
parameters: {
docs: {
toc: false
},
},
}satisfies Meta<typeof Accordion>;
export default meta;
Experiencing the same issue when I upgraded to v8.
@vanessayuenn @shilman I think this feature (override docs plugin parameters in .MDX files) suppose to work because the .MDX file may have different options from story files, like TOC heading selectors. Or is there any alternative way to achieve this?
Describe the bug
When setting
parameters.docs.toc.headingSelectors
in button.stories.tsx, it gets custom TOC settings for this component. example (stories/button.stories.tsx in example):But when setting the same way in changelog.mdx stories file, then it doesn't apply for TOC. (Look under documentation/changelog from example)
But according to the documentation this should work.
To Reproduce
https://stackblitz.com/edit/github-gmbd6l?file=CHANGELOG.md
System
Additional context
No response