Node: docs: incorrect man page link in html modules doc

Created on 13 Mar 2016  路  12Comments  路  Source: nodejs/node

In https://nodejs.org/dist/latest-v5.x/docs/api/modules.html#modules_modules

The following line appears:
var mySquare = square(2);

Which should just be:
var mySquare = square(2);

Looks like the thing that generates links to man pages automatically is a little overzealous.

doc tools

Most helpful comment

Hi, I am new in the open source world and would like to help with this. I think it is easy and it would be my second experience contributing to an open source project. Can I do this?

All 12 comments

Hi, I am new in the open source world and would like to help with this. I think it is easy and it would be my second experience contributing to an open source project. Can I do this?

@jvcjunior Sure, It's some regex parsing. The code can be found at https://github.com/nodejs/node/blob/master/tools/doc/html.js#L183-L198

It's possible that we should instead put some extra formatting around what should be man links, something like [man(2)]() maybe?

cc @nodejs/documentation for advice

We could either add some extra formatting (which would require changing all man links in all the docs, not sure how many there are), or change the doc markdown-to-html tool so that linkManPages is not called within code blocks (by tracking tok.type, sort of like parseLists does). That wouldn't solve the problem in a definitive fashion of course, it just changes less files, and the two can be done in parallel, even. It mostly depends on how many man links there are lying around. If there ain't that many, I'd say go for changing the format, and change the regex in the tool and the links in the markdown (you'll need to rebase the PR periodically).

Just out of curiosity, how do I convert the mardown files to html locally?

@mithun-daa make doc (assuming you are on Unix and have make)

See https://github.com/nodejs/node/blob/master/Makefile#L238-L249 for the source, or if on windows

Another way to solve it would be not to convert to links (linkManPages) when the tok.type === code.

function parseText(lexed) {
  lexed.forEach(function(tok) {
    if (tok.text && tok.type !== 'code') {
      tok.text = linkManPages(tok.text);
    }
  });
}

(Removing label so that @jvcjunior can tackle this)

@mithun-daa Hmm, what if it were in a code comment?

@Fishrock123 Can code blocks have man page links? If I am not mistaken you cannot have any other markdown formatting inside a code block. I tried doing the same on some online markdown editors and it does not work.

I wasn't sure, but fair enough. :)

@jvcjunior This should be a straight enough fix. Let me know if you can do it. If not I'll send in a PR.

@mithun-daa Don't worry about me. You can do this. No problem at all. ;)

Sent PR

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dfahlander picture dfahlander  路  3Comments

addaleax picture addaleax  路  3Comments

vsemozhetbyt picture vsemozhetbyt  路  3Comments

mcollina picture mcollina  路  3Comments

seishun picture seishun  路  3Comments