internal/godoc/dochtml: only recognize "Deprecated" at paragraph start

Treat a function or method as deprecated only if the string
"Deprecated:" occurs at the start of a paragraph.  Previously, we
looked for it at the start of a line.

Also, remove the "deprecated-off" golden file because it was no longer
used.

Fixes golang/go#46913.

Change-Id: I0d16598915677e17565e9944ce67092dcdd208f5
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/400994
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
diff --git a/internal/godoc/dochtml/deprecated.go b/internal/godoc/dochtml/deprecated.go
index ce3688c..4f5b50d 100644
--- a/internal/godoc/dochtml/deprecated.go
+++ b/internal/godoc/dochtml/deprecated.go
@@ -10,7 +10,8 @@
 	"golang.org/x/pkgsite/internal/godoc/internal/doc"
 )
 
-var deprecatedRx = regexp.MustCompile(`(^|\n)\s*Deprecated:`) // "Deprecated:" at the start of a line.
+// "Deprecated:" at the start of a paragraph.
+var deprecatedRx = regexp.MustCompile(`(^|\n\s*\n)\s*Deprecated:`)
 
 // isDeprecated reports whether the string has a "Deprecated" line.
 func isDeprecated(s string) bool {
diff --git a/internal/godoc/dochtml/deprecated_test.go b/internal/godoc/dochtml/deprecated_test.go
index dcfa590..464ad41 100644
--- a/internal/godoc/dochtml/deprecated_test.go
+++ b/internal/godoc/dochtml/deprecated_test.go
@@ -13,9 +13,11 @@
 	}{
 		{"A comment", false},
 		{"Deprecated: foo", true},
-		{" A comment\n   Deprecated: foo", true},
+		{" A comment\n   Deprecated: foo", false},
+		{" A comment\n\n   Deprecated: foo", true},
 		{"This is\n Deprecated.", false},
-		{"line 1\nDeprecated:\nline 2\n", true},
+		{"line 1\nDeprecated:\nline 2\n", false},
+		{"line 1\n\nDeprecated:\nline 2\n", true},
 	} {
 		got := isDeprecated(test.text)
 		if got != test.want {
diff --git a/internal/godoc/dochtml/testdata/deprecated-off.golden b/internal/godoc/dochtml/testdata/deprecated-off.golden
deleted file mode 100644
index 270f1be..0000000
--- a/internal/godoc/dochtml/testdata/deprecated-off.golden
+++ /dev/null
@@ -1,342 +0,0 @@
-<div class="Documentation-content js-docContent"> <section class="Documentation-overview">
-<h3 tabindex="-1" id="pkg-overview" class="Documentation-overviewHeader">Overview <a href="#pkg-overview">¶</a></h3>
-<p>Package deprecated has some deprecated symbols.
-</p>
-</section><section class="Documentation-index">
-<h3 id="pkg-index" class="Documentation-indexHeader">Index <a href="#pkg-index">¶</a></h3>
-<ul class="Documentation-indexList">
-<li class="Documentation-indexConstants"><a href="#pkg-constants">Constants</a></li>
-<li class="Documentation-indexVariables"><a href="#pkg-variables">Variables</a></li>
-<li class="Documentation-indexFunction">
-<a href="#BadF">func BadF()</a></li>
-<li class="Documentation-indexFunction">
-<a href="#GoodF">func GoodF()</a></li>
-<li class="Documentation-indexType">
-<a href="#BadT">type BadT</a></li>
-<li><ul class="Documentation-indexTypeFunctions">
-<li>
-<a href="#NewBadTBad">func NewBadTBad() BadT</a></li>
-<li>
-<a href="#NewBadTGood">func NewBadTGood() BadT</a></li>
-</ul></li>
-<li><ul class="Documentation-indexTypeMethods">
-<li>
-<a href="#BadT.BadM">func (BadT) BadM()</a></li>
-<li>
-<a href="#BadT.GoodM">func (BadT) GoodM()</a></li>
-</ul></li>
-<li class="Documentation-indexType">
-<a href="#GoodT">type GoodT</a></li>
-<li><ul class="Documentation-indexTypeFunctions">
-<li>
-<a href="#NewGoodTBad">func NewGoodTBad() GoodT</a></li>
-<li>
-<a href="#NewGoodTGood">func NewGoodTGood() GoodT</a></li>
-</ul></li>
-<li><ul class="Documentation-indexTypeMethods">
-<li>
-<a href="#GoodT.BadM">func (GoodT) BadM()</a></li>
-<li>
-<a href="#GoodT.GoodM">func (GoodT) GoodM()</a></li>
-</ul></li>
-</ul>
-</section><h3 tabindex="-1" id="pkg-constants" class="Documentation-constantsHeader">Constants <a href="#pkg-constants">¶</a></h3>
-<section class="Documentation-constants">
-<div class="Documentation-declaration">
-<span class="Documentation-declarationLink"><a class="Documentation-source" href="src">View Source</a></span>
-<pre><span id="BadC" data-kind="constant">const BadC = 2</span></pre>
-</div>
-<p>BadC is bad.
-Deprecated: use GoodC.
-</p>
-<div class="Documentation-declaration">
-<span class="Documentation-declarationLink"><a class="Documentation-source" href="src">View Source</a></span>
-<pre><span id="GoodC" data-kind="constant">const GoodC = 1</span></pre>
-</div>
-</section>
-<h3 tabindex="-1" id="pkg-variables" class="Documentation-variablesHeader">Variables <a href="#pkg-variables">¶</a></h3>
-<section class="Documentation-variables">
-<div class="Documentation-declaration">
-<span class="Documentation-declarationLink"><a class="Documentation-source" href="src">View Source</a></span>
-<pre><span id="BadV" data-kind="variable">var BadV = 2</span></pre>
-</div>
-<p>Deprecated: use GoodV.
-</p>
-<div class="Documentation-declaration">
-<span class="Documentation-declarationLink"><a class="Documentation-source" href="src">View Source</a></span>
-<pre><span id="GoodV" data-kind="variable">var GoodV = 1</span></pre>
-</div>
-</section>
-<h3 tabindex="-1" id="pkg-functions" class="Documentation-functionsHeader">Functions <a href="#pkg-functions">¶</a></h3>
-<section class="Documentation-functions"><div class="Documentation-function">
-<h4 tabindex="-1" id="BadF" data-kind="function" class="Documentation-functionHeader">
-<span>func <a class="Documentation-source" href="src">BadF</a> <a class="Documentation-idLink" href="#BadF">¶</a></span>
-<span class="Documentation-sinceVersion">
-</span>
-</h4>
-<div class="Documentation-declaration">
-<pre>func BadF()</pre>
-</div>
-<p>BadF is bad.
-Deprecated: use GoodF.
-</p>
-</div><div class="Documentation-function">
-<h4 tabindex="-1" id="GoodF" data-kind="function" class="Documentation-functionHeader">
-<span>func <a class="Documentation-source" href="src">GoodF</a> <a class="Documentation-idLink" href="#GoodF">¶</a></span>
-<span class="Documentation-sinceVersion">
-</span>
-</h4>
-<div class="Documentation-declaration">
-<pre>func GoodF()</pre>
-</div>
-</div></section>
-<h3 tabindex="-1" id="pkg-types" class="Documentation-typesHeader">Types <a href="#pkg-types">¶</a></h3>
-<section class="Documentation-types"><div class="Documentation-type">
-<h4 tabindex="-1" id="BadT" data-kind="type" class="Documentation-typeHeader">
-<span>type <a class="Documentation-source" href="src">BadT</a> <a class="Documentation-idLink" href="#BadT">¶</a></span>
-<span class="Documentation-sinceVersion">
-</span>
-</h4>
-<div class="Documentation-declaration">
-<pre>type BadT <a href="/builtin#int">int</a></pre>
-</div>
-<p>BadT is bad.
-Deprecated: use GoodT.
-Don&#39;t use this.
-</p>
-<div class="Documentation-typeFunc">
-<h4 tabindex="-1" id="NewBadTBad" data-kind="function" class="Documentation-typeFuncHeader">
-<span>func <a class="Documentation-source" href="src">NewBadTBad</a> <a class="Documentation-idLink" href="#NewBadTBad">¶</a></span>
-<span class="Documentation-sinceVersion">
-</span>
-</h4>
-<div class="Documentation-declaration">
-<pre>func NewBadTBad() <a href="#BadT">BadT</a></pre>
-</div>
-<p>Deprecated: use NewBadTGood.
-</p>
-</div><div class="Documentation-typeFunc">
-<h4 tabindex="-1" id="NewBadTGood" data-kind="function" class="Documentation-typeFuncHeader">
-<span>func <a class="Documentation-source" href="src">NewBadTGood</a> <a class="Documentation-idLink" href="#NewBadTGood">¶</a></span>
-<span class="Documentation-sinceVersion">
-</span>
-</h4>
-<div class="Documentation-declaration">
-<pre>func NewBadTGood() <a href="#BadT">BadT</a></pre>
-</div>
-</div><div class="Documentation-typeMethod">
-<h4 tabindex="-1" id="BadT.BadM" data-kind="method" class="Documentation-typeMethodHeader">
-<span>func (BadT) <a class="Documentation-source" href="src">BadM</a> <a class="Documentation-idLink" href="#BadT.BadM">¶</a></span>
-<span class="Documentation-sinceVersion">
-</span>
-</h4>
-<div class="Documentation-declaration">
-<pre>func (<a href="#BadT">BadT</a>) BadM()</pre>
-</div>
-<p>Deprecated: use GoodM.
-</p>
-</div><div class="Documentation-typeMethod">
-<h4 tabindex="-1" id="BadT.GoodM" data-kind="method" class="Documentation-typeMethodHeader">
-<span>func (BadT) <a class="Documentation-source" href="src">GoodM</a> <a class="Documentation-idLink" href="#BadT.GoodM">¶</a></span>
-<span class="Documentation-sinceVersion">
-</span>
-</h4>
-<div class="Documentation-declaration">
-<pre>func (<a href="#BadT">BadT</a>) GoodM()</pre>
-</div>
-</div>
-</div><div class="Documentation-type">
-<h4 tabindex="-1" id="GoodT" data-kind="type" class="Documentation-typeHeader">
-<span>type <a class="Documentation-source" href="src">GoodT</a> <a class="Documentation-idLink" href="#GoodT">¶</a></span>
-<span class="Documentation-sinceVersion">
-</span>
-</h4>
-<div class="Documentation-declaration">
-<pre>type GoodT <a href="/builtin#int">int</a></pre>
-</div>
-<div class="Documentation-typeFunc">
-<h4 tabindex="-1" id="NewGoodTBad" data-kind="function" class="Documentation-typeFuncHeader">
-<span>func <a class="Documentation-source" href="src">NewGoodTBad</a> <a class="Documentation-idLink" href="#NewGoodTBad">¶</a></span>
-<span class="Documentation-sinceVersion">
-</span>
-</h4>
-<div class="Documentation-declaration">
-<pre>func NewGoodTBad() <a href="#GoodT">GoodT</a></pre>
-</div>
-<p>NewGoodTBad is bad.
-Deprecated: use NewGoodTGood.
-</p>
-</div><div class="Documentation-typeFunc">
-<h4 tabindex="-1" id="NewGoodTGood" data-kind="function" class="Documentation-typeFuncHeader">
-<span>func <a class="Documentation-source" href="src">NewGoodTGood</a> <a class="Documentation-idLink" href="#NewGoodTGood">¶</a></span>
-<span class="Documentation-sinceVersion">
-</span>
-</h4>
-<div class="Documentation-declaration">
-<pre>func NewGoodTGood() <a href="#GoodT">GoodT</a></pre>
-</div>
-</div><div class="Documentation-typeMethod">
-<h4 tabindex="-1" id="GoodT.BadM" data-kind="method" class="Documentation-typeMethodHeader">
-<span>func (GoodT) <a class="Documentation-source" href="src">BadM</a> <a class="Documentation-idLink" href="#GoodT.BadM">¶</a></span>
-<span class="Documentation-sinceVersion">
-</span>
-</h4>
-<div class="Documentation-declaration">
-<pre>func (<a href="#GoodT">GoodT</a>) BadM()</pre>
-</div>
-<p>BadM is bad.
-Deprecated: use GoodM.
-</p>
-</div><div class="Documentation-typeMethod">
-<h4 tabindex="-1" id="GoodT.GoodM" data-kind="method" class="Documentation-typeMethodHeader">
-<span>func (GoodT) <a class="Documentation-source" href="src">GoodM</a> <a class="Documentation-idLink" href="#GoodT.GoodM">¶</a></span>
-<span class="Documentation-sinceVersion">
-</span>
-</h4>
-<div class="Documentation-declaration">
-<pre>func (<a href="#GoodT">GoodT</a>) GoodM()</pre>
-</div>
-</div>
-</div></section></div>
-----
-<ul role="group" id="doc-outline">
-<li role="none">
-<a href="#pkg-overview" role="treeitem" aria-level="2" tabindex="-1"
-data-gtmc="doc outline link">Overview</a>
-</li>
-<li class="DocNav-overview" role="none">
-<a href="#pkg-index" role="treeitem" aria-level="2" tabindex="-1" aria-owns="nav-group-index"
-data-gtmc="doc outline link">
-Index
-</a>
-</li>
-<li class="DocNav-constants" role="none">
-<a href="#pkg-constants" role="treeitem" aria-level="2" tabindex="-1"
-data-gtmc="doc outline link">
-Constants
-</a>
-</li>
-<li class="DocNav-variables" role="none">
-<a href="#pkg-variables" role="treeitem" aria-level="2" tabindex="-1"
-data-gtmc="doc outline link">
-Variables
-</a>
-</li>
-<li class="DocNav-functions" role="none">
-<a href="#pkg-functions" role="treeitem" aria-level="2" tabindex="-1" aria-owns="nav-group-functions"
-aria-expanded="false" data-gtmc="doc outline link">
-Functions
-</a>
-<ul role="group" id="nav-group-functions">
-<li role="none">
-<a href="#BadF" role="treeitem" aria-level="3" tabindex="-1"
-title="BadF()" data-gtmc="doc outline link">
-BadF()
-</a>
-</li>
-<li role="none">
-<a href="#GoodF" role="treeitem" aria-level="3" tabindex="-1"
-title="GoodF()" data-gtmc="doc outline link">
-GoodF()
-</a>
-</li>
-</ul>
-</li>
-<li class="DocNav-types" role="none">
-<a href="#pkg-types" role="treeitem" aria-level="2" tabindex="-1" aria-owns="nav-group-types"
-aria-expanded="false" data-gtmc="doc outline link">
-Types
-</a>
-<ul role="group" id="nav-group-types">
-<li role="none">
-<a href="#BadT" role="treeitem" aria-expanded="false" aria-level="3" tabindex="-1"
-data-aria-owns="nav.group.BadT" title="type BadT"
-data-gtmc="doc outline link">
-type BadT
-</a>
-<ul role="group" id="nav.group.BadT">
-<li role="none">
-<a href="#NewBadTBad" role="treeitem" aria-level="4" tabindex="-1"
-title="NewBadTBad()" data-gtmc="doc outline link">
-NewBadTBad()
-</a>
-</li>
-<li role="none">
-<a href="#NewBadTGood" role="treeitem" aria-level="4" tabindex="-1"
-title="NewBadTGood()" data-gtmc="doc outline link">
-NewBadTGood()
-</a>
-</li>
-<li role="none">
-<a href="#BadT.BadM" role="treeitem" aria-level="4" tabindex="-1"
-title="BadM()" data-gtmc="doc outline link">
-BadM()
-</a>
-</li>
-<li role="none">
-<a href="#BadT.GoodM" role="treeitem" aria-level="4" tabindex="-1"
-title="GoodM()" data-gtmc="doc outline link">
-GoodM()
-</a>
-</li>
-</ul>
-</li>
-<li role="none">
-<a href="#GoodT" role="treeitem" aria-expanded="false" aria-level="3" tabindex="-1"
-data-aria-owns="nav.group.GoodT" title="type GoodT"
-data-gtmc="doc outline link">
-type GoodT
-</a>
-<ul role="group" id="nav.group.GoodT">
-<li role="none">
-<a href="#NewGoodTBad" role="treeitem" aria-level="4" tabindex="-1"
-title="NewGoodTBad()" data-gtmc="doc outline link">
-NewGoodTBad()
-</a>
-</li>
-<li role="none">
-<a href="#NewGoodTGood" role="treeitem" aria-level="4" tabindex="-1"
-title="NewGoodTGood()" data-gtmc="doc outline link">
-NewGoodTGood()
-</a>
-</li>
-<li role="none">
-<a href="#GoodT.BadM" role="treeitem" aria-level="4" tabindex="-1"
-title="BadM()" data-gtmc="doc outline link">
-BadM()
-</a>
-</li>
-<li role="none">
-<a href="#GoodT.GoodM" role="treeitem" aria-level="4" tabindex="-1"
-title="GoodM()" data-gtmc="doc outline link">
-GoodM()
-</a>
-</li>
-</ul>
-</li>
-</ul>
-</li>
-</ul>
-----
-<optgroup label="Documentation">
-<option value="pkg-overview">Overview</option>
-<option value="pkg-index">Index</option>
-<option value="pkg-constants">Constants</option>
-<option value="pkg-variables">Variables</option>
-</optgroup>
-<optgroup label="Functions">
-<option value="BadF">BadF()</option>
-<option value="GoodF">GoodF()</option>
-</optgroup>
-<optgroup label="Types">
-<option value="BadT">type BadT</option>
-<option value="NewBadTBad">NewBadTBad()</option>
-<option value="NewBadTGood">NewBadTGood()</option>
-<option value="BadT.BadM">BadM()</option>
-<option value="BadT.GoodM">GoodM()</option>
-<option value="GoodT">type GoodT</option>
-<option value="NewGoodTBad">NewGoodTBad()</option>
-<option value="NewGoodTGood">NewGoodTGood()</option>
-<option value="GoodT.BadM">BadM()</option>
-<option value="GoodT.GoodM">GoodM()</option>
-</optgroup>
diff --git a/internal/godoc/dochtml/testdata/deprecated-on.golden b/internal/godoc/dochtml/testdata/deprecated-on.golden
index a590526..573d016 100644
--- a/internal/godoc/dochtml/testdata/deprecated-on.golden
+++ b/internal/godoc/dochtml/testdata/deprecated-on.golden
@@ -11,6 +11,8 @@
 <a class="js-deprecatedTagLink" href="#BadF">func BadF()</a><span class="Documentation-indexDeprecated Documentation-deprecatedTag">deprecated</span></li>
 <li class="Documentation-indexFunction">
 <a href="#GoodF">func GoodF()</a></li>
+<li class="Documentation-indexFunction">
+<a href="#WrongF">func WrongF()</a></li>
 <li class="Documentation-indexType">
 <a class="js-deprecatedTagLink" href="#BadT">type BadT</a><span class="Documentation-indexDeprecated Documentation-deprecatedTag">deprecated</span></li>
 <li><ul class="Documentation-indexTypeFunctions">
@@ -24,6 +26,8 @@
 <a class="js-deprecatedTagLink" href="#BadT.BadM">func (BadT) BadM()</a><span class="Documentation-indexDeprecated Documentation-deprecatedTag">deprecated</span></li>
 <li>
 <a href="#BadT.GoodM">func (BadT) GoodM()</a></li>
+<li>
+<a href="#BadT.WrongM">func (BadT) WrongM()</a></li>
 </ul></li>
 <li class="Documentation-indexType">
 <a href="#GoodT">type GoodT</a></li>
@@ -47,12 +51,19 @@
 <pre><span id="BadC" data-kind="constant">const BadC = 2</span></pre>
 </div>
 <p>BadC is bad.
-Deprecated: use GoodC.
+</p><p>Deprecated: use GoodC.
 </p>
 <div class="Documentation-declaration">
 <span class="Documentation-declarationLink"><a class="Documentation-source" href="src">View Source</a></span>
 <pre><span id="GoodC" data-kind="constant">const GoodC = 1</span></pre>
 </div>
+<div class="Documentation-declaration">
+<span class="Documentation-declarationLink"><a class="Documentation-source" href="src">View Source</a></span>
+<pre><span id="WrongC" data-kind="constant">const WrongC = 2</span></pre>
+</div>
+<p>WrongC is wrong.
+Deprecated: use GoodC.
+</p>
 </section>
 <h3 tabindex="-1" id="pkg-variables" class="Documentation-variablesHeader">Variables <a href="#pkg-variables">¶</a></h3>
 <section class="Documentation-variables">
@@ -86,7 +97,7 @@
 <pre>func BadF()</pre>
 </div>
 <p>BadF is bad.
-Deprecated: use GoodF.
+</p><p>Deprecated: use GoodF.
 </p>
 </div>
 </details>
@@ -99,6 +110,18 @@
 <div class="Documentation-declaration">
 <pre>func GoodF()</pre>
 </div>
+</div><div class="Documentation-function">
+<h4 tabindex="-1" id="WrongF" data-kind="function" class="Documentation-functionHeader">
+<span>func <a class="Documentation-source" href="src">WrongF</a> <a class="Documentation-idLink" href="#WrongF">¶</a></span>
+<span class="Documentation-sinceVersion">
+</span>
+</h4>
+<div class="Documentation-declaration">
+<pre>func WrongF()</pre>
+</div>
+<p>WrongF is wrong.
+Deprecated: use GoodF.
+</p>
 </div></section>
 <h3 tabindex="-1" id="pkg-types" class="Documentation-typesHeader">Types <a href="#pkg-types">¶</a></h3>
 <section class="Documentation-types"><div class="Documentation-type">
@@ -119,7 +142,7 @@
 <pre>type BadT <a href="/builtin#int">int</a></pre>
 </div>
 <p>BadT is bad.
-Deprecated: use GoodT.
+</p><p>Deprecated: use GoodT.
 Don&#39;t use this.
 </p>
 <div class="Documentation-typeFunc">
@@ -170,6 +193,8 @@
 <pre>func (<a href="#BadT">BadT</a>) BadM()</pre>
 </div>
 <p>Deprecated: use GoodM.
+You really should.
+For sure.
 </p>
 </div>
 </details>
@@ -182,6 +207,18 @@
 <div class="Documentation-declaration">
 <pre>func (<a href="#BadT">BadT</a>) GoodM()</pre>
 </div>
+</div><div class="Documentation-typeMethod">
+<h4 tabindex="-1" id="BadT.WrongM" data-kind="method" class="Documentation-typeMethodHeader">
+<span>func (BadT) <a class="Documentation-source" href="src">WrongM</a> <a class="Documentation-idLink" href="#BadT.WrongM">¶</a></span>
+<span class="Documentation-sinceVersion">
+</span>
+</h4>
+<div class="Documentation-declaration">
+<pre>func (<a href="#BadT">BadT</a>) WrongM()</pre>
+</div>
+<p>This function is not deprecated.
+Deprecated: not.
+</p>
 </div>
 </div>
 </details>
@@ -212,7 +249,7 @@
 <pre>func NewGoodTBad() <a href="#GoodT">GoodT</a></pre>
 </div>
 <p>NewGoodTBad is bad.
-Deprecated: use NewGoodTGood.
+</p><p>Deprecated: use NewGoodTGood.
 </p>
 </div>
 </details>
@@ -243,7 +280,7 @@
 <pre>func (<a href="#GoodT">GoodT</a>) BadM()</pre>
 </div>
 <p>BadM is bad.
-Deprecated: use GoodM.
+</p><p>Deprecated: use GoodM.
 </p>
 </div>
 </details>
@@ -300,6 +337,12 @@
 GoodF()
 </a>
 </li>
+<li role="none">
+<a href="#WrongF" role="treeitem" aria-level="3" tabindex="-1"
+title="WrongF()" data-gtmc="doc outline link">
+WrongF()
+</a>
+</li>
 </ul>
 </li>
 <li class="DocNav-types" role="none">
@@ -339,6 +382,12 @@
 GoodM()
 </a>
 </li>
+<li role="none">
+<a href="#BadT.WrongM" role="treeitem" aria-level="4" tabindex="-1"
+title="WrongM()" data-gtmc="doc outline link">
+WrongM()
+</a>
+</li>
 </ul>
 </li>
 <li role="none">
@@ -387,6 +436,7 @@
 <optgroup label="Functions">
 <option value="BadF">BadF()</option>
 <option value="GoodF">GoodF()</option>
+<option value="WrongF">WrongF()</option>
 </optgroup>
 <optgroup label="Types">
 <option value="BadT">type BadT</option>
@@ -394,6 +444,7 @@
 <option value="NewBadTGood">NewBadTGood()</option>
 <option value="BadT.BadM">BadM()</option>
 <option value="BadT.GoodM">GoodM()</option>
+<option value="BadT.WrongM">WrongM()</option>
 <option value="GoodT">type GoodT</option>
 <option value="NewGoodTBad">NewGoodTBad()</option>
 <option value="NewGoodTGood">NewGoodTGood()</option>
diff --git a/internal/godoc/dochtml/testdata/deprecated.go b/internal/godoc/dochtml/testdata/deprecated.go
index 23bed0f..f9ee785 100644
--- a/internal/godoc/dochtml/testdata/deprecated.go
+++ b/internal/godoc/dochtml/testdata/deprecated.go
@@ -8,9 +8,14 @@
 const GoodC = 1
 
 // BadC is bad.
+//
 // Deprecated: use GoodC.
 const BadC = 2
 
+// WrongC is wrong.
+// Deprecated: use GoodC.
+const WrongC = 2
+
 var GoodV = 1
 
 // Deprecated: use GoodV.
@@ -20,25 +25,35 @@
 
 /*
    BadF is bad.
+
    Deprecated: use GoodF.
 */
 func BadF() {}
 
+/*
+   WrongF is wrong.
+   Deprecated: use GoodF.
+*/
+func WrongF() {}
+
 type GoodT int
 
 func NewGoodTGood() GoodT {}
 
 // NewGoodTBad is bad.
+//
 // Deprecated: use NewGoodTGood.
 func NewGoodTBad() GoodT {}
 
 func (GoodT) GoodM() {}
 
 // BadM is bad.
+//
 // Deprecated: use GoodM.
 func (GoodT) BadM() {}
 
 // BadT is bad.
+//
 // Deprecated: use GoodT.
 // Don't use this.
 type BadT int
@@ -51,4 +66,10 @@
 func (BadT) GoodM() {}
 
 // Deprecated: use GoodM.
+// You really should.
+// For sure.
 func (BadT) BadM() {}
+
+// This function is not deprecated.
+// Deprecated: not.
+func (BadT) WrongM() {}