diff options
Diffstat (limited to 'src/pkg/go/doc/comment.go')
-rw-r--r-- | src/pkg/go/doc/comment.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/pkg/go/doc/comment.go b/src/pkg/go/doc/comment.go index 6f0edd4ba..c4b7e6ae6 100644 --- a/src/pkg/go/doc/comment.go +++ b/src/pkg/go/doc/comment.go @@ -174,7 +174,7 @@ func unindent(block []string) { } // heading returns the trimmed line if it passes as a section heading; -// otherwise it returns the empty string. +// otherwise it returns the empty string. func heading(line string) string { line = strings.TrimSpace(line) if len(line) == 0 { @@ -229,7 +229,8 @@ type block struct { var nonAlphaNumRx = regexp.MustCompile(`[^a-zA-Z0-9]`) func anchorID(line string) string { - return nonAlphaNumRx.ReplaceAllString(line, "_") + // Add a "hdr-" prefix to avoid conflicting with IDs used for package symbols. + return "hdr-" + nonAlphaNumRx.ReplaceAllString(line, "_") } // ToHTML converts comment text to formatted HTML. |