-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
doc: Broken (404ing) links in Docs #26074
Comments
|
The generation takes place here: Lines 125 to 142 in 6f64cda
|
Looks like a bug. Filter |
https://linux.die.net/man/3/uname this link is for the https://github.com/nodejs/node/blob/master/doc/api/os.md generated by that snippet too. I think that maybe we have to do something like this following the snippet logic: const BSD_ONLY_SYSCALLS = new Set(['lchmod']);
const LINUX_DIE_ONLY_SYSCALLS = new Set(['uname']);
const HAXX_ONLY_SYSCALLS = new Set(['curl']);
const MAN_PAGE = /(^|\s)([a-z.]+)\((\d)([a-z]?)\)/gm;
// Handle references to man pages, eg "open(2)" or "lchmod(2)".
// Returns modified text, with such refs replaced with HTML links, for example
// '<a href="http://man7.org/linux/man-pages/man2/open.2.html">open(2)</a>'.
function linkManPages(text) {
return text.replace(
MAN_PAGE, (match, beginning, name, number, optionalCharacter) => {
// Name consists of lowercase letters,
// number is a single digit with an optional lowercase letter.
const displayAs = `<code>${name}(${number}${optionalCharacter})</code>`;
if (BSD_ONLY_SYSCALLS.has(name)) {
return `${beginning}<a href="https://www.freebsd.org/cgi/man.cgi` +
`?query=${name}&sektion=${number}">${displayAs}</a>`;
} else if (LINUX_DIE_ONLY_SYSCALLS.has(name)) {
return `${beginning}<a href="https://linux.die.net/man/` +
`${number}/${name}">${displayAs}</a>`;
} else if (HAXX_ONLY_SYSCALLS.has(name)) {
return `${beginning}<a href="https://${name}.haxx.se/docs/manpage.html">${displayAs}</a>`;
} else {
return `${beginning}<a href="http://man7.org/linux/man-pages/man${number}` +
`/${name}.${number}${optionalCharacter}.html">${displayAs}</a>`;
}
});
} If everything is ok here, Can I send a PR for this? |
Change the linkManPages function to catch the uname and curl correct websites on the docs page. Fixes: nodejs#26074
Thanks to @JustinBeckwith's linkinator tool, I was able to pretty easily check our docs to see if any of the links were 404ing. Turns out we currently have 2 404s somewhere in the docs. Here are the links that are 404ing:
At a bare minimum, you could view source on
docs/api/all.html
and search for these links to identify where they are in the docs.The tool currently falsely reports all DevTools protocol links as 404ing when they are not actually 404ing. I'll open up an issue on the linkinator repo for that.
The text was updated successfully, but these errors were encountered: