-
Notifications
You must be signed in to change notification settings - Fork 18k
go.dev: include '¶' permalinks in all package doc subheadings #36808
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Would you mind clarifying if you are able to link subsections today using the same URL scheme from godoc.org? For example: https://pkg.go.dev/testing?tab=doc#hdr-Benchmarks My understanding is that this issue is specifically asking to add a clickable /cc @dmitshur |
As you demonstrated, that appears to work (not that I had tried)
Exactly, as per the original description:
|
I've sent a CL that should fix this issue once it is deployed. We can keep this issue open to confirm everything is working as expected. |
This is super important, thank you @dmitshur ! |
This fix has been deployed and it's working as expected. For example, see:
Note that it may not appear on some existing package versions until they've been reprocessed, but they should work on all new versions. Please let us know if you spot any other issues. |
…ings Make it an option that can be toggled, so it is easier to tell that this feature is different from the original CL 72890. This option can be deleted later when there are fewer godoc variants and the flexibility it offers becomes no longer needed. This package is internal, so changing its API can be done at any time. Background The render package was initially developed in the context of the golang.org/x/tools/cmd/godoc command. That command historically used the ToHTML function from go/doc package, which did not have functionality to insert permalinks for headings. That functionality was later implemented in https://golang.org/cl/33641 on the frontend using JavaScript. It was done on the frontend because modifying the go/doc package was slow, and because the intent was to make a change affecting the entire golang.org website. Here, we have full control over the documentation HTML rendering, so it's easy to implement this functionality on the backend for the needs of the discovery site. Fixes golang/go#36808. Change-Id: Icb0210f9e0870a7bbf80e0aa80ba2e6421177ba8 Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/698511 Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julieqiu@google.com>
What is the URL of the page with the issue?
https://pkg.go.dev/testing?tab=doc
What is your user agent?
Screenshot
What did you do?
Tried to link to the "Benchmarks" subsection of the
testing
package docs.What did you expect to see?
Each subheading to be a link such that hovering over it (the heading) a
¶
symbol should appear, like on godoc:Clicking that link should then change to the address bar URL to include the fragment. For example on godoc, for the "Benchmarks" subsection we end up with the URL:
https://godoc.org/testing#hdr-Benchmarks
What did you see instead?
No ability to link to subsections of package documentation.
The text was updated successfully, but these errors were encountered: