-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
Addon-docs: Fix Table of Contents heading leak #23677
Conversation
/** | ||
* Ignore headings that did not | ||
* come from the main markdown code. | ||
*/ | ||
// ignoreSelector: ':not(.sbdocs), .hide-from-toc', | ||
ignoreSelector: ignoreSelector ?? '.docs-story *, .skip-toc', |
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.
@shilman — This approach seems sound to me, but you're the one who left the commented-out version to seemingly accomplish the same thing, so thought you'd like to chime in.
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.
Looks great, thanks!
What's the status on this one @JReinhold @shilman? Any reason why this is not merged? |
Addon-docs: Fix Table of Contents heading leak (cherry picked from commit 17e7244)
Addon-docs: Fix Table of Contents heading leak (cherry picked from commit 17e7244)
Addon-docs: Fix Table of Contents heading leak (cherry picked from commit 17e7244)
Addon-docs: Fix Table of Contents heading leak (cherry picked from commit 17e7244)
Addon-docs: Fix Table of Contents heading leak (cherry picked from commit 17e7244)
Addon-docs: Fix Table of Contents heading leak (cherry picked from commit 17e7244)
Closes #23541
What I did
Exclude all content from Story blocks from being indexed by the Table of Contents (TOC) component by default. The user can still override the
ignoreSelector
to adjust this behaviour.How to test
sandbox/.storybook/preview.ts
file:yarn start
Docs
pageAcme
headings from the sample component do not bleed into the generated Table of ContentsTo test the previous behaviour, do the same thing and note the difference in Table of Contents.
Checklist
MIGRATION.MD (N/A)
Maintainers
ci:normal
,ci:merged
orci:daily
GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli/src/sandbox-templates.ts
["cleanup", "BREAKING CHANGE", "feature request", "bug", "build", "documentation", "maintenance", "dependencies", "other"]
🦋 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/core
team 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>