-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: shouldn't consider "e.g." a sentence ender when getting first line of a doc string #59189
Comments
a work around could be e.g. "for instance"? |
IIRC pkgsite uses |
Good point. I hadn't considered the other places where this is visible. Given the documentation of that function, this seems working as specified and documented, so if the behaviour is going to change I guess this has to go through the full proposal process. |
With that said, go/doc.Synopsis currently has clear, simple semantics. We may not be able to change those semantics without breaking compatibility. Even if we could, I don't think supporting this use-case is worth the loss of simplicity. In summary:
go/doc is a contract that package authors can use to control the structure of their documentation in various tools. The contract is clear about the meaning of periods: "That sentence ends after the first period followed by space and not |
Inclined to agree, yeah. I think the documentation of the function itself is fine, but needs pointing to. I think the following two sentences in the documentation, which are the main reference points for learning about Go doc comments, could do with a footnote.
In https://tip.golang.org/doc/comment:
With a footnote such as: 1: The meaning of "first sentence" here is specified exactly by [go.doc/Synopsis]. I'm going to close this issue and open one for x/website instead. Thanks for the replies! |
What did you do?
Publish a module on pkg.go.dev with subfolders, one containing a file with a docstring like so:
What did you expect to see?
The "#section-directories" anchor for the main page for the module on the website should list the subfolders like this:
What did you see instead?
The description is truncated like this:
Notes
A proper implementation would handle other separators such as "i.e.", and documentation written in other languages etc. w.r.t.
Unicode® Standard Annex #29: Unicode Text Segmentation: Sentence Boundaries. One challenge is that the locale would probably have to be guessed as it isn't set in documentation explicitly anywhere.
The text was updated successfully, but these errors were encountered: