aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2018-07-05 21:38:02 -0400
committerRuss Cox <rsc@golang.org>2018-07-06 18:40:55 +0000
commitfb72965df06e193bce0b999a0b5cb2a7b817fc7c (patch)
treebd127cb6fc9a80cee0767a41992463d50ad29696 /src
parentc5ac91d0e1082914d3eeb8dff9d80974eb1bf9b7 (diff)
downloadgo-fb72965df06e193bce0b999a0b5cb2a7b817fc7c.tar.xz
go/doc: update header rules
Go documentation can have header lines, which are single-line paragraphs with leading and trailing letters and almost no punctuation. Before this CL, the only allowed punctuation was ' followed by s. After this CL, parentheses and commas are also allowed, to pick up a pair of previously unrecognized headings in the go command documentation: Gofmt (reformat) package sources Modules, module versions, and more Change-Id: I6d59c40a1269f01cef62a3fb17b909571c2f2adb Reviewed-on: https://go-review.googlesource.com/122407 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Andrew Bonventre <andybons@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/go/doc/comment.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/go/doc/comment.go b/src/go/doc/comment.go
index 4228e8cd9c..7c4490e7c3 100644
--- a/src/go/doc/comment.go
+++ b/src/go/doc/comment.go
@@ -231,8 +231,8 @@ func heading(line string) string {
return ""
}
- // exclude lines with illegal characters
- if strings.ContainsAny(line, ",.;:!?+*/=()[]{}_^°&§~%#@<\">\\") {
+ // exclude lines with illegal characters. we allow "(),"
+ if strings.ContainsAny(line, ".;:!?+*/=[]{}_^°&§~%#@<\">\\") {
return ""
}
@@ -281,7 +281,7 @@ func anchorID(line string) string {
// a single paragraph. There is one exception to the rule: a span that
// consists of a single line, is followed by another paragraph span,
// begins with a capital letter, and contains no punctuation
-// is formatted as a heading.
+// other than parentheses and commas is formatted as a heading.
//
// A span of indented lines is converted into a <pre> block,
// with the common indent prefix removed.