Skip to content
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 fixes #9703

Closed
wants to merge 13 commits into from
Closed

Doc fixes #9703

wants to merge 13 commits into from

Conversation

davidgilbertson
Copy link
Contributor

Checklist
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

doc

Description of change

This fixes a number of issues in the documentation, originally logged as an issue here. As suggested by @bnoordhuis I have combined them in a single PR with 14 commits.

The relevant items (copied from the original issue I logged):

@nodejs-github-bot nodejs-github-bot added the doc Issues and PRs related to the documentations. label Nov 20, 2016
Copy link
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small request, otherwise this looks pretty good! Thanks!

@@ -370,6 +370,7 @@ when the server has no more open connections.
### server.connections
<!-- YAML
added: v0.3.2
deprecated: v0.9.7
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooooh good catch!

doc/api/vm.md Outdated

// { animal: 'cat', count: 12, name: 'kitty' }
```

### script.runInNewContext([sandbox][, options])
### script.runInNewContext(sandbox[, options])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be [sandbox[, options]] – the sandbox is really optional, but options can only be passed when sandbox is, too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Anna. How should I handle this, just another commit?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidgilbertson If you’re git-savvy enough, I’d suggest changing the commit in this PR that made the original modification; i.e. git rebase -i master, replacing pick with edit for cb555d106c1edec7db2fe2ac6b96c088f0c92c36, then running the rebase.

You can also add another commit if that’s easier for you; generally, any way that makes a person who lands this PR understand what’s going on should be fine. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An hour later I can report back that I am not git-savvy enough. I've have just added another commit to make this change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidgilbertson that’s perfectly okay… thanks for being so invested in this! :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem. This is my first open source contribution, I'm having fun.

@@ -172,14 +172,14 @@ console.log(encrypted);
// Prints: ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504
```

### cipher.final([output_encoding])
### cipher.final([outputEncoding])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these changes have to be updated in the links at the bottom of this page.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, thanks. I've updated the links in the footer. Actually I missed some other snake_case items on the page, I've fixed them up.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also check links in other md files.

doc/api/path.md Outdated
base : "file.txt",
ext : ".txt",
name : "file"
name : "file",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an object, I don't think this change is necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd agree not necessary, but these same five props are listed in five different places on the page, in different orders. The change just puts them all in the same order: dir, root, base, name, ext.

doc/api/tls.md Outdated
@@ -789,8 +790,6 @@ added: v0.11.3
* `port` {number}
* `host` {string}
* `options` {Object}
* `host` {string} Host the client should connect to.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still supported. We can pass host and port either directly or by setting them in options. In this case, both host and port are optional.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh OK. So, on that page, there is one signature tls.connect(options[, callback]) (which has port and host props) and then another one tls.connect(port[, host][, options][, callback]) (which is where this change is). So I thought showing port and host was redundant.

If they're valid I will add them back. Do you think it's worth documenting what would happen if you passed in a host, then an options object with a different host defined?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think that behaviour should definitely be documented.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Qard So ... what's the behaviour? Or should that be a separate PR, and if so, should I remove this change for now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that can be a separate PR. I'd suggest just leaving the host and port fields in the options description for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed this, too, I'll be PRing fixes to the tls.connect docs soon. Btw, options port/host overrides args port/host, which is opposite of what I would expect :-(


Every method has a `*Sync` counterpart, which accept the same arguments, but
without a callback.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer this not be removed without the above additions explaining the distinction that the *Sync label is what indicates a method is synchronous. Your current wording could be misinterpreted as meaning that the exact same method could become synchronous by simply not giving it a callback.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was just to align it with the equivalent note about sync/async methods in fs which is currently:

All the methods have asynchronous and synchronous forms.

The asynchronous form always takes a completion callback as its last argument. The arguments passed to the completion callback ...

So the zlib text for the same would be (with the change in this PR):

All the methods have asynchronous and synchronous forms. The asynchronous form always takes a completion callback as its last argument in the form callback(error, result).

Note that just below this on the page the actual sync and non-sync methods are listed explicitly.

Does that change things? Otherwise, I can revert it to how it was.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm...I suppose it's okay. I'd just like the sync vs async distinction to be clearer in docs in general. It's a major source of pain for new users, especially ones for which English is not their native language. I don't want to block this PR on that though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing beats an example, maybe (not this PR) a bare-bones comparison of fs.readFile() and fs.readFileSync() and the equivalent for zlib.

@@ -172,14 +172,14 @@ console.log(encrypted);
// Prints: ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504
```

### cipher.final([output_encoding])
### cipher.final([outputEncoding])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes break "hard links" and as such I do not think we should do this unless necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't realise that when I started, now I know I think you're quite right. It would be nice if everything was camelCase, but if everyone is happy for there to be this inconsistency then I'll revert this back.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, probably best the camel-casing be reverted.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either that, or check all the links and update them, its easy to grep for what they used to be, though a bit painful to fix them all. Still, consistent camelCase would improve the docs, if you've the appetite for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the issue is the links out on the internet linking in to particular methods in the node docs. They would then just go to the top of the page.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Fishrock123 I have removed these changes from the PR.

@@ -425,9 +425,7 @@ s.bind(1234, () => {
});
```

## `dgram` module functions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why? you just removed this header, and bumped out the level, so now all the dgram.* functions are documented as methods of the dgram.Socket class.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No this will have them listed at the same level as the classes. It's the same as http, https, readline, fs, etc. L1 heading is the module name, L2 is each class and each static (if that's the right word) method and property. L3 is for class instance methods/props.

dgram was the odd one out, this was just for consistency. Although, having just gone to check I didn't do something dumb, I notice that crypto also pushes all the module functions/props down to L3, but there is seems to make sense.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed

 Show the encoding parameter as optional if the data parameter is passed in
Remove util.inspect() wrapper which is redundant inside console.log()
Fix [options] being parsed as a link and
therefore not showing as an optional parameter (the brackets were stripped).
Improved the clarity of the wording around passing of the options object
Add
<!-- YAML
added: v7.1.0
-->

to zlib.constants
Update the wording of the description of asynchronous and synchronous
description for the zlib methods to match the
description given for fs methods.
This lists the elements in the order dir, root, base, name, ext
for path.format() and path.parse()
To make consistent with other pages, add the word "optional" to the description
of path.resolve()
Remove spaces in tlsSocket.getPeerCertificate([ detailed ])
Remove the level-2 heading for "dgram module functions"
and promote the two level-3 static methods to level-2
to align with the docs from other modules.
sandbox and options parameters were shown as independently optional which was not correct
@davidgilbertson
Copy link
Contributor Author

@Fishrock123 I removed those changes that you commented on, are you able to approve?

@italoacasas
Copy link
Contributor

ping @Fishrock123 can you give the green light on this?

ping @davidgilbertson you need to rebase in order to land this, thanks for the effort.

@davidgilbertson
Copy link
Contributor Author

@italoacasas I've resolved the conflicts.

@addaleax
Copy link
Member

@davidgilbertson Can you try to rebase this instead of merging master into your PR branch? Doing git rebase master (rather than git merge master) and then force-pushing should do the trick. If that doesn’t work out, that’s fine too, it would just be easier to keep the commits intact that way.

@davidgilbertson
Copy link
Contributor Author

Ah OK my bad, I just tried github's new conflict-resolution-in-the-browser thing, I guess it does a merge.

I'll wait for fishrock then do it properly once.

@addaleax
Copy link
Member

@davidgilbertson … looks like you may need to rebase once more anyway. (The conflict seems to be my fault, dc49838 vs 753021c – I’m pretty sure 7.0.0 is the correct version, though. Sorry!)

@jasnell
Copy link
Member

jasnell commented Mar 24, 2017

Needs a rebase to continue

@jasnell jasnell added the stalled Issues and PRs that are stalled. label Mar 24, 2017
@addaleax
Copy link
Member

Ping @davidgilbertson, can you rebase this again? :)

@fhinkel
Copy link
Member

fhinkel commented May 26, 2017

There hasn't been any activity here. I'm closing this. Feel free to reopen (or ping a collaborator) if I closed this in error.

@fhinkel fhinkel closed this May 26, 2017
@tniessen tniessen mentioned this pull request Jun 6, 2017
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. stalled Issues and PRs that are stalled.
Projects
None yet
Development

Successfully merging this pull request may close these issues.