Skip to content

Commit d534b3e

Browse files
[docs] Fix the link test script (#43195)
1 parent 07431e5 commit d534b3e

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

docs/.link-check-errors.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
Broken links found by `pnpm docs:link-check` that exist:
22

3+
- https://mui.com/material-ui/customization/css-theme-variables/configuration/#advanced-configuration
4+
- https://mui.com/material-ui/customization/css-theme-variables/configuration/#changing-variable-prefixes
5+
- https://mui.com/material-ui/customization/theme-components/#creating-new-component-variants
6+
- https://mui.com/material-ui/customization/theme-components/#overrides-based-on-props
7+
- https://mui.com/material-ui/react-grid2/#whats-changed

docs/scripts/reportBrokenLinks.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ function getPageLinks(markdown) {
1010
const hrefs = [];
1111

1212
const renderer = new marked.Renderer();
13-
renderer.link = (href) => {
14-
if (href[0] === '/') {
13+
renderer.link = ({ href }) => {
14+
if (href.startsWith('/')) {
1515
hrefs.push(href);
1616
}
1717
};
@@ -211,8 +211,12 @@ if (require.main === module) {
211211
.filter((link) => UNSUPPORTED_PATHS.every((unsupportedPath) => !link.includes(unsupportedPath)))
212212
.sort()
213213
.forEach((linkKey) => {
214+
//
215+
// <!-- #default-branch-switch -->
216+
//
214217
write(`- https://mui.com${linkKey}`);
215218
console.log(`https://mui.com${linkKey}`);
219+
216220
console.log(`used in`);
217221
usedLinks[linkKey].forEach((f) => console.log(`- ${path.relative(docsSpaceRoot, f)}`));
218222
console.log('available anchors on the same page:');

0 commit comments

Comments
 (0)