-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Addon-docs: Support disable TOC in unattached MDX #31075
New issue
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
base: next
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
4 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
|
View your CI Pipeline Execution ↗ for commit d1c977d
☁️ Nx Cloud last updated this comment at |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
Package BenchmarksCommit: The following packages have significant changes to their size or dependencies:
|
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 187 | 187 | 0 |
| Self size | 68 KB | 68 KB | 0 B |
| Dependency size | 31.79 MB | 31.82 MB | 🚨 +28 KB 🚨 |
| Bundle Size Analyzer | Link | Link |
@storybook/angular
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 187 | 187 | 0 |
| Self size | 126 KB | 126 KB | 0 B |
| Dependency size | 29.95 MB | 29.97 MB | 🚨 +28 KB 🚨 |
| Bundle Size Analyzer | Link | Link |
@storybook/ember
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 191 | 191 | 0 |
| Self size | 17 KB | 17 KB | 0 B |
| Dependency size | 28.50 MB | 28.53 MB | 🚨 +28 KB 🚨 |
| Bundle Size Analyzer | Link | Link |
@storybook/nextjs
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 532 | 532 | 0 |
| Self size | 950 KB | 950 KB | 0 B |
| Dependency size | 58.49 MB | 58.52 MB | 🚨 +28 KB 🚨 |
| Bundle Size Analyzer | Link | Link |
@storybook/react-webpack5
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 272 | 272 | 0 |
| Self size | 25 KB | 25 KB | 0 B |
| Dependency size | 43.45 MB | 43.48 MB | 🚨 +28 KB 🚨 |
| Bundle Size Analyzer | Link | Link |
@storybook/server-webpack5
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 199 | 199 | 0 |
| Self size | 17 KB | 17 KB | 0 B |
| Dependency size | 33.04 MB | 33.07 MB | 🚨 +28 KB 🚨 |
| Bundle Size Analyzer | Link | Link |
@storybook/cli
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 187 | 187 | 0 |
| Self size | 920 KB | 920 KB | 0 B |
| Dependency size | 79.83 MB | 79.86 MB | 🚨 +28 KB 🚨 |
| Bundle Size Analyzer | Link | Link |
@storybook/codemod
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 169 | 169 | 0 |
| Self size | 35 KB | 35 KB | 0 B |
| Dependency size | 76.26 MB | 76.28 MB | 🚨 +28 KB 🚨 |
| Bundle Size Analyzer | Link | Link |
@storybook/preset-react-webpack
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 170 | 170 | 0 |
| Self size | 21 KB | 21 KB | 0 B |
| Dependency size | 30.94 MB | 30.97 MB | 🚨 +28 KB 🚨 |
| Bundle Size Analyzer | Link | Link |
Closes #23672
What I did
docs.toc.disableUnattachedMdxto be set in.storybook/preview.tsWhy not allow this on a per-file basis? Currently we don't have a convenient system for setting parameters on unattached MDX. We can set tags on MDX files, but that's more intrusive than parameters, so I am proposing this first in the hope that it's good enough for most use cases.
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
yarn storybook:uicode/.storybook/preview.tsx:🦋 Canary release
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/coreteam here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>Greptile Summary
This PR introduces a new parameter to disable the Table of Contents on unattached MDX files, with updates across configuration, documentation examples, and core rendering logic in DocsContainer.
/code/.storybook/preview.tsxto add a new, commenteddocs.toc.disableUnattachedMdxparameter for testing./code/addons/docs/template/stories/docs2/Title.mdxto include various heading formats to test TOC behavior./code/lib/blocks/src/blocks/DocsContainer.tsxto conditionally render the TOC based on the new parameter./docs/writing-docs/autodocs.mdxdocs to explain the disabling option for unattached MDX files.