Skip to content

Commit fcb7318

Browse files
authored
feat(internal/docfx): full cross reference linking (#3656)
1 parent e88cbc4 commit fcb7318

File tree

3 files changed

+585
-368
lines changed

3 files changed

+585
-368
lines changed

internal/godocfx/parse.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
// +build go1.15
1616

1717
// TODO:
18-
// pkgsite.PrintType doesn't linkify.
1918
// IDs for const/var groups have every name, not just the one to link to.
2019
// Preserve IDs when sanitizing then use the right ID for linking.
2120
// Link to different domains by pattern (e.g. for cloud.google.com/go).
@@ -182,7 +181,7 @@ func parse(glob string, workingDir string, optionalExtraFiles []string) (*result
182181
Type: "const",
183182
Summary: c.Doc,
184183
Langs: onlyGo,
185-
Syntax: syntax{Content: pkgsite.PrintType(pi.fset, c.Decl)},
184+
Syntax: syntax{Content: pkgsite.PrintType(pi.fset, c.Decl, toURL)},
186185
})
187186
}
188187
for _, v := range pi.doc.Vars {
@@ -198,7 +197,7 @@ func parse(glob string, workingDir string, optionalExtraFiles []string) (*result
198197
Type: "variable",
199198
Summary: v.Doc,
200199
Langs: onlyGo,
201-
Syntax: syntax{Content: pkgsite.PrintType(pi.fset, v.Decl)},
200+
Syntax: syntax{Content: pkgsite.PrintType(pi.fset, v.Decl, toURL)},
202201
})
203202
}
204203
for _, t := range pi.doc.Types {
@@ -212,7 +211,7 @@ func parse(glob string, workingDir string, optionalExtraFiles []string) (*result
212211
Type: "type",
213212
Summary: t.Doc,
214213
Langs: onlyGo,
215-
Syntax: syntax{Content: pkgsite.PrintType(pi.fset, t.Decl)},
214+
Syntax: syntax{Content: pkgsite.PrintType(pi.fset, t.Decl, toURL)},
216215
Examples: processExamples(t.Examples, pi.fset),
217216
}
218217
// Note: items are added as page.Children, rather than
@@ -231,7 +230,7 @@ func parse(glob string, workingDir string, optionalExtraFiles []string) (*result
231230
Type: "const",
232231
Summary: c.Doc,
233232
Langs: onlyGo,
234-
Syntax: syntax{Content: pkgsite.PrintType(pi.fset, c.Decl)},
233+
Syntax: syntax{Content: pkgsite.PrintType(pi.fset, c.Decl, toURL)},
235234
})
236235
}
237236
for _, v := range t.Vars {
@@ -247,7 +246,7 @@ func parse(glob string, workingDir string, optionalExtraFiles []string) (*result
247246
Type: "variable",
248247
Summary: v.Doc,
249248
Langs: onlyGo,
250-
Syntax: syntax{Content: pkgsite.PrintType(pi.fset, v.Decl)},
249+
Syntax: syntax{Content: pkgsite.PrintType(pi.fset, v.Decl, toURL)},
251250
})
252251
}
253252

0 commit comments

Comments
 (0)