x/pkgsite: anchor links to specific constants #52184
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
pkgsite
UX
Issues that involve UXD/UXR input
Milestone
What is the URL of the page with the issue?
Any package with constants, but https://pkg.go.dev/time is a good example.
What did you expect to see?
The ability to browse to an anchor link to a specific constant or
const
block.pkgsite provides the ability to link to the section that contains package-level constants, e.g. https://pkg.go.dev/time#pkg-constants. But this section may be very large, and in this example, may contain important information that is required in order to use the package properly (specifically parsing and formatting).
It is not possible to easily link to the documentation for a specific constant. We see this limitation worked around in https://pkg.go.dev/time#Parse, where the reader is directed to "the documentation for the constant called Layout to see how to represent the format". The reader has to first navigate to the constants section, and then find the named constant, which in this case happens to be start of the section, but may not necessarily be.
This is perhaps part of a slightly bigger issue where pkgsite runs all package-level constant documentation into each other, producing a large section of text without sub-headings. In the case of https://pkg.go.dev/time#pkg-constants, the reader is presented with a single section covering both formatting layouts and
Duration
, without any separation between them at all.The text was updated successfully, but these errors were encountered: