Skip to content
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

x/pkgsite: anchor links to specific constants #52184

Open
joe-mann opened this issue Apr 6, 2022 · 1 comment
Open

x/pkgsite: anchor links to specific constants #52184

joe-mann opened this issue Apr 6, 2022 · 1 comment
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

Comments

@joe-mann
Copy link

joe-mann commented Apr 6, 2022

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.

@gopherbot gopherbot added this to the pkgsite/unplanned milestone Apr 6, 2022
@jamalc jamalc added UX Issues that involve UXD/UXR input NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Apr 8, 2022
@jamalc
Copy link

jamalc commented Apr 8, 2022

A way to browse anchor links to constants like Layout is to press the 'f' key or 'Jump to ...' button to open identifier search. You can search for and navigate to constants by name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

3 participants