镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

doc: Broken (404ing) links in Docs #26074

Description

@bnb

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.

Activity

  1. added
    docIssues and PRs related to Node.js documentation.
    on Feb 14, 2019
  2. gengjiawen commented on Feb 14, 2019

    @gengjiawen
    Member

    http://man7.org/linux/man-pages/man1/curl.1.html this link is in this page https://nodejs.org/api/repl.html, The link is not in the repl.md, maybe we have a bug in generating the html.
    image

  3. vsemozhetbyt commented on Feb 14, 2019

    @vsemozhetbyt
    Contributor

    The generation takes place here:

    node/tools/doc/html.js

    Lines 125 to 142 in 6f64cda

    // 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>`;
    }
    return `${beginning}<a href="http://man7.org/linux/man-pages/man${number}` +
    `/${name}.${number}${optionalCharacter}.html">${displayAs}</a>`;
    });
    }

  4. gengjiawen commented on Feb 14, 2019

    @gengjiawen
    Member

    Looks like a bug. Filter curl and uname for now ?

  5. 07Gond commented on Feb 27, 2019

    @07Gond
    Contributor

    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 we try this we got:
    image

    If everything is ok here, Can I send a PR for this?

  6. added a commit that references this issue on Apr 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to Node.js documentation.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions