MCPcopy Create free account
hub / github.com/adobe/react-spectrum / mdxToUrl

Function mdxToUrl

packages/dev/s2-docs/scripts/testAccessibility.mjs:152–172  ·  view source on GitHub ↗
(mdxPath, options)

Source from the content-addressed store, hash-verified

150
151// Convert MDX file path to URL path
152function mdxToUrl(mdxPath, options) {
153 // Remove .mdx extension
154 let urlPath = mdxPath.replace(/\.mdx$/, '');
155
156 // Handle index pages
157 if (urlPath.endsWith('/index')) {
158 urlPath = urlPath.slice(0, -6);
159 }
160
161 // Optionally strip the s2/ or react-aria/ prefix
162 if (options.stripPrefix) {
163 urlPath = urlPath.replace(/^(s2|react-aria)\//, '');
164 }
165
166 // Optionally add .html extension
167 if (options.htmlExt) {
168 urlPath = urlPath + '.html';
169 }
170
171 return `${options.baseUrl}/${urlPath}`;
172}
173
174// Format Axe results for display
175function formatAxeResults(results, url, ignoredRules = new Set()) {

Callers 1

testAccessibilityFunction · 0.85

Calls 1

sliceMethod · 0.80

Tested by

no test coverage detected