[docs] Fix pathname collision in LLMs docs generator
Root Cause
Before: https://mui.com/material-ui/migration/upgrade-to-v7.md (show native color content which is wrong)
The findNonComponentMarkdownFiles() function uses findPagesMarkdown() which strips the filename from the path to create a "pathname". When multiple markdown files exist in the same directory, they produce identical pathnames:
docs/data/material/migration/upgrade-to-v7/
├── upgrade-to-v7.md → pathname: /material/migration/upgrade-to-v7
└── upgrade-to-native-color.md → pathname: /material/migration/upgrade-to-v7 (collision!)
The find() method then returns the first alphabetically ordered file (upgrade-to-native-color.md), causing upgrade-to-v7.md to be generated with the wrong content.
Solution
Updated the file matching logic to use:
-
Filename basename match - Compare the actual filename (e.g.,
upgrade-to-v7) - Parent path verification - Ensure the file is in the expected directory
This prevents collisions while maintaining compatibility with the existing file structure.
Testing
Verified all 13 migration files generate with correct content:
- ✅
upgrade-to-v7.md→ "Upgrade to v7" content - ✅
upgrade-to-native-color.md→ "Upgrade to native color" content
Netlify deploy preview
https://deploy-preview-47209--material-ui.netlify.app/
Bundle size report
| Bundle | Parsed size | Gzip size |
|---|---|---|
| @mui/material | 0B(0.00%) | 0B(0.00%) |
| @mui/lab | 0B(0.00%) | 0B(0.00%) |
| @mui/system | 0B(0.00%) | 0B(0.00%) |
| @mui/utils | 0B(0.00%) | 0B(0.00%) |
Generated by :no_entry_sign: dangerJS against dd8c366e2c17574dbf41e91aaa98c35bfbd28051