-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
go/doc: improve headings, lists, and links #51082
Comments
Change https://go.dev/cl/384263 mentions this issue: |
Change https://go.dev/cl/384257 mentions this issue: |
Change https://go.dev/cl/384267 mentions this issue: |
Change https://go.dev/cl/384258 mentions this issue: |
Change https://go.dev/cl/384265 mentions this issue: |
Change https://go.dev/cl/384266 mentions this issue: |
Change https://go.dev/cl/384268 mentions this issue: |
Change https://go.dev/cl/384264 mentions this issue: |
Change https://go.dev/cl/384259 mentions this issue: |
Change https://go.dev/cl/384260 mentions this issue: |
Change https://go.dev/cl/384274 mentions this issue: |
The top comment has been filled in now. |
This solves 90% of my problems working with docstrings and makes the remaining 10% trivial. I am ecstatic! I'd be perfectly happy to have this accepted as-is but I do have a couple minor thoughts: I'd s/Text/Inline/g and then s/Plain/Text/g to align with html. That could just be familiarity but it seems clearer to me. Allow subheadings with |
For now I think we should keep things simple and not increase scope past the previous discussion. There would really be no problem with having ## render as a paragraph during a later transition. Single # is rendering as a paragraph during this one. |
In numbered point 5 in the goals and non-goals, the absence of in-line image support is noted for a couple of languages and support by one, but no mention of Python (a much more relevant language than for example Perl). Here it does exist in some projects https://numpy.org/doc/stable/reference/generated/numpy.fft.fft.html#numpy.fft.fft and in general, Python doc strings may be valid reStructuredText which allows embedding of images. |
Python supports images in their docs, noted. |
I am extremely excited about this! A couple of questions / suggestions.
Again, really looking forward to this in any case. |
Overall this looks good, but I want to restate my concern about the accessibility issues I raised with the approach to marking links. |
Thanks for the questions, @ainar-g.
|
@kortschak Noted re link syntax. I don't have anything more to add beyond #48305 (comment). |
It's worth noting that I did follow that up OOB with a detailed response, but did not receive a reply. |
Overall, this is exciting to see. A few quick questions about linking to headers and the relationship to the base URL.
In any event, I think the ability to link to headers would be extremely useful, especially for complex packages. |
This proposal has been added to the active column of the proposals project |
This short sentence was missing a period at the end, which caused it to be interpreted as a heading. It also gained a '# ' prefix as part of new gofmt formatting applied in CL 384268. This change makes it a regular sentence as originally intended. Updates golang#51082. Change-Id: I100410cca21e4f91130f1f3432327bb6d66b12a2 Reviewed-on: https://go-review.googlesource.com/c/go/+/418959 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
Gofmt to update doc comments to the new formatting. (There are so many files in x/tools I am breaking up the gofmt'ing into multiple CLs. This is the leftovers.) For golang/go#51082. Change-Id: Id9d440cde9de7093d2ffe06cbaa7098993823d6b Reviewed-on: https://go-review.googlesource.com/c/tools/+/399363 Run-TryBot: Russ Cox <rsc@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
Gofmt to update doc comments to the new formatting. For golang/go#51082. Change-Id: I3e3c5666d5e901f2c5303911ddb548e3dd567fce Reviewed-on: https://go-review.googlesource.com/c/text/+/399603 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
Gofmt to update doc comments to the new formatting. For golang/go#51082. Change-Id: I076031b6613691eefbb0f21739366e3fd2011ec9 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/399356 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
Gofmt to update doc comments to the new formatting. For golang/go#51082. Change-Id: I076031b6613691eefbb0f21739366e3fd2011ec9 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/399356 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
Gofmt to update doc comments to the new formatting. For golang/go#51082. Change-Id: Iae68a9cd600060577271575e893ecb23bed1e509 Reviewed-on: https://go-review.googlesource.com/c/net/+/399599 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
Is godoc 1.19 suppose to render the following as links?
The 1.19 release notes refers to https://go.dev/doc/comment#doclinks. When attempting that in godoc, it is not generating package links. (I did |
Gofmt to update doc comments to the new formatting. For golang/go#51082. Change-Id: Id333e34e0c5cd0bea79dcf5dd51130639597b2ee Reviewed-on: https://go-review.googlesource.com/c/oauth2/+/399616 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
Gofmt to update doc comments to the new formatting. For golang/go#51082. Change-Id: I076031b6613691eefbb0f21739366e3fd2011ec9 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/399356 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
Gofmt to update doc comments to the new formatting. For golang/go#51082. Change-Id: Ic98f647623f234cf5d36309c6204683e151820d7 Reviewed-on: https://go-review.googlesource.com/c/example/+/399596 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
Gofmt to update doc comments to the new formatting. For golang/go#51082. Change-Id: I5fd6eaa2a711d27051045aaaef45799a12777e48 Reviewed-on: https://go-review.googlesource.com/c/vuln/+/399605 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Roland Shoemaker <roland@golang.org>
Gofmt to update doc comments to the new formatting. For golang/go#51082. Change-Id: I5fd6eaa2a711d27051045aaaef45799a12777e48 Reviewed-on: https://go-review.googlesource.com/c/vuln/+/399605 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Roland Shoemaker <roland@golang.org>
Gofmt to update doc comments to the new formatting. For golang/go#51082. Change-Id: Ic98f647623f234cf5d36309c6204683e151820d7 Reviewed-on: https://go-review.googlesource.com/c/example/+/399596 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
golang/go#51082 changed how gofmt handles some comments, so we need to slightly reformat them to avoid `gofmt -s -d .` errors.
Gofmt to update doc comments to the new formatting. (There are so many files in x/tools I am breaking up the gofmt'ing into multiple CLs. This is the leftovers.) For golang/go#51082. Change-Id: Id9d440cde9de7093d2ffe06cbaa7098993823d6b Reviewed-on: https://go-review.googlesource.com/c/tools/+/399363 Run-TryBot: Russ Cox <rsc@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
Gofmt to update doc comments to the new formatting. For golang/go#51082. Change-Id: I5fd6eaa2a711d27051045aaaef45799a12777e48 Reviewed-on: https://go-review.googlesource.com/c/vuln/+/399605 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Roland Shoemaker <roland@golang.org>
Gofmt to update doc comments to the new formatting. For golang/go#51082. Change-Id: I076031b6613691eefbb0f21739366e3fd2011ec9 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/399356 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
This proposal improves support for headings, lists, and links in Go doc comments,
while remaining backwards compatible with existing comments.
It includes a new package,
go/doc/comment
, exposing a parsed syntax tree fordoc comments, and it includes changes to
go/printer
and thereforegofmt
to format doc comments in a standard way.
For example, existing lists reformat from the display on the left to the one on the right:
URL links can be rewritten to change the display on the left to the one on the right:
And package doc comments (and others) can be rewritten to link to specific symbols:
The full design doc is at https://github.com/golang/proposal/blob/master/design/51082-godocfmt.md.
The text was updated successfully, but these errors were encountered: