_template: make headings self-hyperlinks

This makes it easy to get a section link by clicking on the section heading.
Also add support for {#ID} in Markdown, in addition to the auto-generated anchors.

Change-Id: Idd9d6c7cec2395f86808220c885861dc6c45e9d6
Reviewed-on: https://go-review.googlesource.com/c/blog/+/314173
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
diff --git a/_content/survey2020.article b/_content/survey2020.article
index 6d645d0..95bcb72 100644
--- a/_content/survey2020.article
+++ b/_content/survey2020.article
@@ -6,7 +6,7 @@
 Alice Merrick
 amerrick@google.com
 
-## Help shape the future of Go
+## Help shape the future of Go {#help}
 
 Since 2016, thousands of Gophers around the world have helped the Go project
 by sharing their thoughts via our annual Go Developer Survey.
diff --git a/_template/doc.tmpl b/_template/doc.tmpl
index f7f5f5b..3289ce9 100644
--- a/_template/doc.tmpl
+++ b/_template/doc.tmpl
@@ -29,7 +29,9 @@
 {{end}}
 
 {{define "section"}}
-  <h4 id="TOC_{{.FormattedNumber}}">{{.Title}}</h4>
+  {{$name := printf "TOC_%s" .FormattedNumber}}
+  {{with .ID}}{{$name = .}}{{end}}
+  <a {{with .ID}}name="{{.}}" {{end}}class="head" href="#{{$name}}"><h4 id="TOC_{{.FormattedNumber}}">{{.Title}}</h4></a>
   {{range .Elem}}{{elem $.Template .}}{{end}}
 {{end}}
 
diff --git a/_template/root.tmpl b/_template/root.tmpl
index 78a0ee8..6000c1a 100644
--- a/_template/root.tmpl
+++ b/_template/root.tmpl
@@ -33,6 +33,13 @@
     overflow-wrap: normal;
     padding: 0;
   }
+  a.head {
+    color: black;
+    text-decoration: none !important;
+  }
+  a.head:hover {
+    text-decoration: underline;
+  }
   @media print {
     #sidebar { display: none; }
   }