Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
go.dev: display table of contents (TOC) in command documentation #38073
What is the URL of the page with the issue?
What did you do?
Visited command documentation. As an example, see https://pkg.go.dev/cmd/go, but this applies to any command (package with name "main").
What did you expect to see?
A table of contents, like on https://golang.org/cmd/go:
What did you see instead?
No table of contents.
This is a feature request to have feature parity with previous documentation rendering on golang.org and the
I meant to compare with golang.org (powered by x/tools/godoc). godoc.org (powered by github.com/golang/gddo) doesn't implement this feature.
Some implementation notes.
golang.org renders (via x/tools/godoc package) the table of contents on the frontend via a generateTOC function here:
pkg.go.dev does not need to do this on the frontend, it can render a table of contents on the backend (together with the where all of package documentation rendering currently happens).
This table of contents is applicable only for commands; library packages already have an index (the one that lists all the functions, types, methods, etc.) which serves as a table of contents.
x/tools/godoc uses a div named "manual-nav" to disable the frontend from generating a table of contents for non-commands. See: