-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: links in package synopsis don't work in directory list #57964
Comments
This is using https://pkg.go.dev/go/doc#Package.Synopsis, which returns a string rather than markdown. I'm not convinced we should change this. Synopses are served in many places where markdown/html doesn't work. IMO it may be better to avoid it in the first sentence of a package doc. We could of course add special handling to pkgsite, but then that would be enabling a convention that is problematic for other tools. |
That's fair enough, but is that convention documented anywhere? It's the first time I hear of a package godoc synopsis, and https://go.dev/doc/comment doesn't say anything about them or about avoiding links in them :) |
@rsc suspected that this may simply be a bug in go/doc: the Synopsis function should correctly translate link syntax into plaintext, dropping the '[]'s. |
The tests in src/go/doc/comment_test.go look like doc.(*Package).Synopsis already drops the [ ] but the old top-level doc.Synopsis does not, because it doesn't have accurate information about which [ ] correspond to links. Perhaps pkgsite is using the old doc.Synopsis and should migrate to doc.(*Package).Synopsis? |
In pkgsite, I found
It looks like doc.Synopsis(d.Doc) should be d.Synopsis(d.Doc). |
@rsc thanks for looking into it. That looks right. Want to send a CL, or shall I? |
I'll leave the CL to you - it'll get done faster. Thanks. |
@findleyr Did this get fixed? |
What is the URL of the page with the issue?
https://pkg.go.dev/mvdan.cc/sh/v3@v3.6.1-0.20230123163603-8b4fb75c77da#section-directories
What is your user agent?
Screenshot
What did you do?
Started using doc links in my godoc comments. Used a link to a package in another package's godoc.
What did you expect to see?
The link to render properly in all relevant pkg.go.dev pages.
What did you see instead?
It renders properly in the package itself: https://pkg.go.dev/mvdan.cc/sh/v3@v3.6.1-0.20230123163603-8b4fb75c77da/cmd/gosh
However, the link remains in its plaintext form in the directory view: https://pkg.go.dev/mvdan.cc/sh/v3@v3.6.1-0.20230123163603-8b4fb75c77da#section-directories
The text was updated successfully, but these errors were encountered: