Node: Include links to source code in documentation

Created on 19 Aug 2018  路  6Comments  路  Source: nodejs/node

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

doc feature request

Most helpful comment

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: https://github.com/rails/rails/commit/fc5dd0b85189811062c85520fd70de8389b55aeb). 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.

All 6 comments

@nodejs/documentation @nodejs/website

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.

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: https://github.com/rails/rails/commit/fc5dd0b85189811062c85520fd70de8389b55aeb). 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.

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

seishun picture seishun  路  3Comments

jmichae3 picture jmichae3  路  3Comments

vsemozhetbyt picture vsemozhetbyt  路  3Comments

Icemic picture Icemic  路  3Comments

akdor1154 picture akdor1154  路  3Comments