-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Doc fixes #9703
Conversation
There was a problem hiding this 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 |
There was a problem hiding this comment.
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]) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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. :)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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! :)
There was a problem hiding this comment.
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.
doc/api/crypto.md
Outdated
@@ -172,14 +172,14 @@ console.log(encrypted); | |||
// Prints: ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504 | |||
``` | |||
|
|||
### cipher.final([output_encoding]) | |||
### cipher.final([outputEncoding]) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
.
doc/api/crypto.md
Outdated
@@ -172,14 +172,14 @@ console.log(encrypted); | |||
// Prints: ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504 | |||
``` | |||
|
|||
### cipher.final([output_encoding]) | |||
### cipher.final([outputEncoding]) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
83a1482
to
9c16e77
Compare
@Fishrock123 I removed those changes that you commented on, are you able to approve? |
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. |
@italoacasas I've resolved the conflicts. |
@davidgilbertson Can you try to rebase this instead of merging |
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. |
@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!) |
Needs a rebase to continue |
Ping @davidgilbertson, can you rebase this again? :) |
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. |
Checklist
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):
Should
tls.connect()
listhost
andport
in the options if they're already params?https://nodejs.org/api/tls.html#tls_tls_connect_port_host_options_callback
Seems weird that
path.resolve()
arguments are optional. Worth documenting that the method returns'.'
if you pass nothing in?https://nodejs.org/api/path.html#path_path_join_paths
https://nodejs.org/api/path.html#path_path_resolve_paths
The params for
path.format()
andpath.parse()
are in different orders,format()
is logically wrong based on the diagram underparse()
https://nodejs.org/api/path.html#path_path_format_pathobject
https://nodejs.org/api/path.html#path_path_parse_path
There shouldn't be spaces in
tlsSocket.getPeerCertificate([ detailed ])
https://nodejs.org/api/tls.html#tls_tlssocket_getpeercertificate_detailed
net.Server
showsconnections
as deprecated...https://nodejs.org/api/net.html#net_server_connections
tls.Server
inherits from this, but doesn't showconnections
as deprecatedhttps://nodejs.org/api/tls.html#tls_server_connections
Should it?
Is the
encoding
parameter allowed if thedata
parameter isn't set?Should: request.end([data][, encoding][, callback])
be: request.end([data[, encoding]][, callback])
?
https://nodejs.org/api/http.html#http_request_end_data_encoding_callback
dgram
has a header "dgram module functions" before the static methods, none of the other pages do this. Is the dgram module different, or is this just an inconsistency?https://nodejs.org/api/dgram.html#dgram_dgram_module_functions
Parameter names are almost always camelCase, except in crypto where they're snake_case.
https://nodejs.org/api/crypto.html#crypto_cipher_final_output_encoding
Is that an inconsistency or is there meaning in that?
Using
util.inspect()
insideconsole.log()
is redundant (I think. Isn't it?)https://nodejs.org/api/events.html#events_emitter_listeners_eventname
https://nodejs.org/api/vm.html#vm_vm_runincontext_code_contextifiedsandbox_options
https://nodejs.org/api/vm.html#vm_script_runinnewcontext_sandbox_options
Missing apostrophe in "run using the vm modules methods"
https://nodejs.org/api/vm.html#vm_what_does_it_mean_to_contextify_an_object
I have no idea about this one, but is sandbox really optional in
script.runInNewContext()
?If I call
script.runInNewContext(options)
, wouldn't it try and make a sandbox out of the options object? I went looking through the source but found myself in a strange land and gave up.https://nodejs.org/api/vm.html#vm_script_runinnewcontext_sandbox_options
zlib.constants
is missing "added in version..." (and is quite new so this is a problem)https://nodejs.org/api/zlib.html#zlib_zlib_constants
Looks like this commit
197a465#diff-c245d87dba893de0b77c7574f0081633R388
zlib
methods all haveoptions
as an argument, but not shown in square brackets (but in the TOC they're shown in square brackets). Less important, but having the word in the argument list be linked is inconsistent with the other pages. The description contains the word 'options' which is linked to the class options section.Wording is strange for zlib methods, e.g. "Returns a new
Deflate
object with an options."By comparison, in
net.connect()
the equivalent wording is something like "The options are passed to thenet.Socket
constructor"https://nodejs.org/api/zlib.html
The wording for there being Sync version of methods is different for
fs
andzlib
.https://nodejs.org/api/zlib.html#zlib_convenience_methods
https://nodejs.org/api/fs.html#fs_file_system