Repository navigation
docs(button): Expand accessibility section for AI codegen #4183
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: master
Are you sure you want to change the base?
Changes from all commits
3e48585
634b3dc
fd7c94f
24d6337
ff4268e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import type {Plugin} from 'unified'; | ||
| import {visit} from 'unist-util-visit'; | ||
|
|
||
| import routes from './routes'; | ||
|
|
||
| /** | ||
| * Rewrites Canvas site paths (`/components/.../`) to Storybook manager URLs for local docs and | ||
| * GitHub Pages. Runs during MDX compile so links in tables and nested MDX are included. | ||
| */ | ||
| export function remarkRewriteCanvasRoutes(): Plugin { | ||
| const routeKeys = new Set(Object.keys(routes)); | ||
|
|
||
| return tree => { | ||
| visit(tree, 'link', node => { | ||
| const url = node.url; | ||
| if (typeof url !== 'string' || !url.startsWith('/')) { | ||
| return; | ||
| } | ||
|
|
||
| const hashIndex = url.indexOf('#'); | ||
| const pathPart = hashIndex === -1 ? url : url.slice(0, hashIndex); | ||
| const hash = hashIndex === -1 ? '' : url.slice(hashIndex + 1); | ||
|
|
||
| if (!routeKeys.has(pathPart)) { | ||
| return; | ||
| } | ||
|
|
||
| const storyId = routes[pathPart as keyof typeof routes]; | ||
| node.url = `../?path=/docs/${storyId}${hash ? `#${hash}` : ''}`; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Keep manager links under the Storybook project path. If the iframe is at
📍 Affects 2 files
🤖 Prompt for AI Agents |
||
| }); | ||
| }; | ||
| } | ||
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.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Match fragment-specific routes before splitting the URL. The route map contains
/get-started/for-developers/documentation/testing#visual-tests. Both rewriters discard its fragment before lookup, so they cannot select its mapped destination..storybook/remark-rewrite-canvas-routes.ts#L24-L24: check the full URL for a mapped route before looking uppathPart..storybook/vite-plugin-redirect-mdx-to-github.ts#L22-L22: check the full URL before using the fragment-free URL for fallback lookup.📍 Affects 2 files
.storybook/remark-rewrite-canvas-routes.ts#L24-L24(this comment).storybook/vite-plugin-redirect-mdx-to-github.ts#L22-L22🤖 Prompt for AI Agents