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

Include links to source code in documentation #22393

Closed
mtharrison opened this issue Aug 19, 2018 · 6 comments
Closed

Include links to source code in documentation #22393

mtharrison opened this issue Aug 19, 2018 · 6 comments
Labels
doc Issues and PRs related to the documentations. feature request Issues that request new features to be added to Node.js.

Comments

@mtharrison
Copy link
Contributor

mtharrison commented Aug 19, 2018

Describe the solution you'd like
For someone who's learning about the internals of node, it's useful to know exactly where in the codebase certain functions are implemented. I think it would be nice if the node docs linked say a function (like setTimeout) to the line in source code (on Github perhaps) where that function is implemented.

How it works in rust docs

Rust doc does this and I think it's a really nice feature that helps those wishing to dig deeper but isn't so intrusive to confuse or overwhelm newcomers.

screen shot 2018-08-19 at 09 40 32

How it might work for node docs

screen shot 2018-08-19 at 09 48 38

@Trott
Copy link
Member

Trott commented Aug 19, 2018

@nodejs/documentation @nodejs/website

@devsnek
Copy link
Member

devsnek commented Aug 19, 2018

we wouldn't be able to reliably do this unless we switched to some form of inline documentation. at a minimum some tag like // @source timers.setImmediate would be needed.

@vsemozhetbyt vsemozhetbyt added doc Issues and PRs related to the documentations. feature request Issues that request new features to be added to Node.js. labels Aug 19, 2018
@rubys
Copy link
Member

rubys commented Aug 19, 2018

Live example from Rust: try_reserve.

Rails does something similar: Rails.env.

Links to GitHub are appealing, but would require the build process to get the final commit hash (example from Rails: rails/rails@fc5dd0b). Rust appears to take a different path: produce a syntax highlighted set of pages that is published with the documentation, and provide links into that.

While this is clearly a non-trivial amount of work, I agree that it would be very useful, and would be fun to develop. I'll try to create a small proof of concept in the next week or two.

@mtharrison
Copy link
Contributor Author

@rubys cool! Let me know if I can help in any way.

@refack
Copy link
Contributor

refack commented Aug 30, 2018

Fixed in #22405 (comment) By 6046570

@refack refack closed this as completed Aug 30, 2018
@mtharrison
Copy link
Contributor Author

Awesome. Thanks so much for working on this @rubys!

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. feature request Issues that request new features to be added to Node.js.
Projects
None yet
Development

No branches or pull requests

6 participants