You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Include links to source code in documentation #22393
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.
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.
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.
Activity
Trott commentedon Aug 19, 2018
@nodejs/documentation @nodejs/website
devsnek commentedon 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.setImmediatewould be needed.rubys commentedon 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 commentedon Aug 19, 2018
@rubys cool! Let me know if I can help in any way.
refack commentedon Aug 30, 2018
Fixed in #22405 (comment) By 6046570
mtharrison commentedon Aug 31, 2018
Awesome. Thanks so much for working on this @rubys!