-
Notifications
You must be signed in to change notification settings - Fork 4
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
Source linking #73
Comments
I just found out about this great project! I developed something similar myself https://code.pfad.fr/vanitydoc/ (however the scope of my tool is much much smaller than yours). For source-code linking, I based my logic on https://git.sr.ht/~ancarda/vcs-autodiscovery-rfc/tree/HEAD/RFC.md and exported a dedicated package: https://code.pfad.fr/vanitydoc/autodiscovery/ Maybe it can serve as inspiration for your tool. |
Hi, perhaps something like:
multiple
Pitfall: passed
|
Thanks @oliverpool, I intend to look at that when I implement this. Auto-discovery does sound quite nice from the UX POV, but I also don't want network requests to be the default. It may have to be an opt-in. @maxatome, that is along the lines of what I was thinking for this feature! doc2go already has a -pkg-doc flag that follows a similar pattern. The template will probably also want a variable for import path of the file package relative to the PACKAGE specified in PACKAGE=TMPL. This would allow something like
Not a concern! doc2go already implements that for pkg-doc. It's quite straightforward: given import path aaa/bbb/ccc/ddd, pick the closest ancestor with a template specified. All that said, I don't have an immediate prediction for when this functionality will be available. |
The vcs, err := autodiscovery.New("github", "https://github.com/abhinav/doc2go", "main")
vcs.LineURL(path, ref, line) // gives you the URL to view the given file at the given line |
Oh, excellent! That fills in the "built-in support for GitHub, GitLab, SourceHut, etc." bit above. |
Yes, I mis-explained it: those meta tags should be exposed by doc2go (and can be consumed by other tools). |
We should add opt-in support for linking to source code for a package.
This will likely need a
-pkg-doc
-style thing for documentation generated from multiple repositories,but it also needs an easy way for common cases where the code is hosted in a GitHub/GitLab/SourceHut/etc. repository.
Related:
https://github.com/golang/gddo/wiki/Source-Code-Links
https://pkg.go.dev/about#source-links
The text was updated successfully, but these errors were encountered: