@@ -6,76 +6,76 @@ var pkgTemplate = `{{with .PDoc}}
6
6
{{comment_md .Doc}}
7
7
{{else}}
8
8
# {{ .Name }}
9
+ ` + "`" + `import "{{.ImportPath}}"` + "`" + `
9
10
10
- * [Overview](#markdown-header -overview)
11
- * [Index](#markdown-header -index){{if $.Examples}}
12
- * [Examples](#markdown-header -examples){{- end}}{{if $.Dirs}}
13
- * [Subdirectories](#markdown-header -subdirectories){{- end}}
11
+ * [Overview](#pkg -overview)
12
+ * [Index](#pkg -index){{if $.Examples}}
13
+ * [Examples](#pkg -examples){{- end}}{{if $.Dirs}}
14
+ * [Subdirectories](#pkg -subdirectories){{- end}}
14
15
15
- ## Overview
16
+ ## <a name="pkg-overview"> Overview</a>
16
17
{{comment_md .Doc}}
17
18
{{example_html $ ""}}
18
- {{example_text $ "" " "}}
19
19
20
- ## Index{{if .Consts}}
21
- * [Constants](#markdown-header -constants){{end}}{{if .Vars}}
22
- * [Variables](#markdown-header -variables){{end}}{{- range .Funcs -}}{{$name_html := html .Name}}
23
- * [{{node_html $ .Decl false | sanitize | bitscape }}](#markdown-header-{{node_html $ .Decl false | sanitize | kebab }}){{- end}}{{- range .Types}}{{$tname_html := html .Name}}
24
- * [type {{$tname_html}}](#markdown-header-type-{{kebab $tname_html}}){{- range .Funcs}}{{$name_html := html .Name}}
25
- * [{{node_html $ .Decl false | sanitize | bitscape }}](#markdown-header-func- {{$name_html | kebab }}){{- end}}{{- range .Methods}}{{$name_html := html .Name}}
26
- * [{{node_html $ .Decl false | sanitize | bitscape }}](#markdown-header-func-{{md .Recv | kebab}}- {{$name_html | kebab }}){{- end}}{{- end}}{{- if $.Notes}}{{- range $marker, $item := $.Notes}}
27
- * [{{noteTitle $marker | html}}s](#markdown-header -{{noteTitle $marker | html | kebab}}s }}){{end}}{{end}}
20
+ ## <a name="pkg-index"> Index</a> {{if .Consts}}
21
+ * [Constants](#pkg -constants){{end}}{{if .Vars}}
22
+ * [Variables](#pkg -variables){{end}}{{- range .Funcs -}}{{$name_html := html .Name}}
23
+ * [{{node_html $ .Decl false | sanitize}}](#{{$name_html }}){{- end}}{{- range .Types}}{{$tname_html := html .Name}}
24
+ * [type {{$tname_html}}](#{{ $tname_html}}){{- range .Funcs}}{{$name_html := html .Name}}
25
+ * [{{node_html $ .Decl false | sanitize}}](#{{$name_html}}){{- end}}{{- range .Methods}}{{$name_html := html .Name}}
26
+ * [{{node_html $ .Decl false | sanitize}}](#{{$tname_html}}. {{$name_html}}){{- end}}{{- end}}{{- if $.Notes}}{{- range $marker, $item := $.Notes}}
27
+ * [{{noteTitle $marker | html}}s](#pkg-note -{{$marker}}){{end}}{{end}}
28
28
{{if $.Examples}}
29
- #### Examples{{- range $.Examples}}
30
- * [{{example_name .Name}}]{{- end}}{{- end}}
29
+ #### <a name="pkg-examples"> Examples</a> {{- range $.Examples}}
30
+ * [{{example_name .Name}}](#example_{{.Name}}) {{- end}}{{- end}}
31
31
{{with .Filenames}}
32
- #### Package files
33
- {{range .}}[{{.|filename|html}}]{{end}}
32
+ #### <a name="pkg-files"> Package files</a>
33
+ {{range .}}[{{.|filename|html}}]({{.|srcLink|html}}) {{end}}
34
34
{{end}}
35
35
36
- {{with .Consts}}## Constants
36
+ {{with .Consts}}## <a name="pkg-constants"> Constants</a>
37
37
{{range .}}{{node $ .Decl | pre}}
38
38
{{comment_md .Doc}}{{end}}{{end}}
39
- {{with .Vars}}## Variables
39
+ {{with .Vars}}## <a name="pkg-variables"> Variables</a>
40
40
{{range .}}{{node $ .Decl | pre}}
41
41
{{comment_md .Doc}}{{end}}{{end}}
42
42
43
- {{range .Funcs}}{{$name_html := html .Name}}## func [{{$name_html}}]
43
+ {{range .Funcs}}{{$name_html := html .Name}}## <a name="{{$name_html}}"> func</a> [{{$name_html}}]({{posLink_url $ .Decl}})
44
44
{{node $ .Decl | pre}}
45
45
{{comment_md .Doc}}
46
- {{example_text $ .Name " " }}
46
+ {{example_html $ .Name}}
47
47
{{callgraph_html $ "" .Name}}{{end}}
48
- {{range .Types}}{{$tname := .Name}}{{$tname_html := html .Name}}## type [{{$tname_html}}]
48
+ {{range .Types}}{{$tname := .Name}}{{$tname_html := html .Name}}## <a name="{{$tname_html}}"> type</a> [{{$tname_html}}]({{posLink_url $ .Decl}})
49
49
{{node $ .Decl | pre}}
50
50
{{comment_md .Doc}}{{range .Consts}}
51
51
{{node $ .Decl | pre }}
52
52
{{comment_md .Doc}}{{end}}{{range .Vars}}
53
53
{{node $ .Decl | pre }}
54
54
{{comment_md .Doc}}{{end}}
55
55
56
- {{example_text $ $tname " " }}
56
+ {{example_html $ $tname}}
57
57
{{implements_html $ $tname}}
58
58
{{methodset_html $ $tname}}
59
59
60
- {{range .Funcs}}{{$name_html := html .Name}}### func [{{$name_html}}]
60
+ {{range .Funcs}}{{$name_html := html .Name}}### <a name="{{$name_html}}"> func</a> [{{$name_html}}]({{posLink_url $ .Decl}})
61
61
{{node $ .Decl | pre}}
62
62
{{comment_md .Doc}}
63
- {{example_text $ .Name " " }}{{end}}
63
+ {{example_html $ .Name}}{{end}}
64
64
{{callgraph_html $ "" .Name}}
65
65
66
- {{range .Methods}}{{$name_html := html .Name}}### func ({{md .Recv}}) [{{$name_html}}]
66
+ {{range .Methods}}{{$name_html := html .Name}}### <a name="{{$tname_html}}.{{$name_html}}"> func</a> ({{md .Recv}}) [{{$name_html}}]({{posLink_url $ .Decl}})
67
67
{{node $ .Decl | pre}}
68
68
{{comment_md .Doc}}
69
- {{$name := printf "%s_%s" $tname .Name}}{{example_text $ $name " " }}
69
+ {{$name := printf "%s_%s" $tname .Name}}{{example_html $ $name}}
70
70
{{callgraph_html $ .Recv .Name}}
71
71
{{end}}{{end}}{{end}}
72
72
73
73
{{with $.Notes}}
74
74
{{range $marker, $content := .}}
75
- ## {{noteTitle $marker | html}}s
75
+ ## <a name="pkg-note-{{$marker}}"> {{noteTitle $marker | html}}s
76
76
<ul style="list-style: none; padding: 0;">
77
77
{{range .}}
78
- <li>☞ {{html .Body}}</li>
78
+ <li><a href="{{posLink_url $ .}}"> ☞</a> {{html .Body}}</li>
79
79
{{end}}
80
80
</ul>
81
81
{{end}}
0 commit comments