Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions internal/godoc/dochtml/internal/render/linkify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,18 @@ b := 1
line comment.
*/
</pre>
`,
},
{
"An Output comment must appear at the start of the line.",
`_ = true
// This comment containing "// Output:" is not treated specially.
`,
`
<pre class="Documentation-exampleCode">
_ = true
// This comment containing &#34;// Output:&#34; is not treated specially.
</pre>
`,
},
} {
Expand Down
3 changes: 2 additions & 1 deletion internal/godoc/dochtml/internal/render/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import (

var (
// Regexp for example outputs.
exampleOutputRx = regexp.MustCompile(`(?i)//[[:space:]]*(unordered )?output:`)
// Keep consistent with outputPrefix in GOROOT/src/go/doc/example.go.
exampleOutputRx = regexp.MustCompile(`(?i)^[[:space:]]*//[[:space:]]*(unordered )?output:`)
)

type Renderer struct {
Expand Down