Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(internal/docfx): full cross reference linking #3656

Merged
merged 3 commits into from Feb 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 5 additions & 6 deletions internal/godocfx/parse.go
Expand Up @@ -15,7 +15,6 @@
// +build go1.15

// TODO:
// pkgsite.PrintType doesn't linkify.
// IDs for const/var groups have every name, not just the one to link to.
// Preserve IDs when sanitizing then use the right ID for linking.
// Link to different domains by pattern (e.g. for cloud.google.com/go).
Expand Down Expand Up @@ -182,7 +181,7 @@ func parse(glob string, workingDir string, optionalExtraFiles []string) (*result
Type: "const",
Summary: c.Doc,
Langs: onlyGo,
Syntax: syntax{Content: pkgsite.PrintType(pi.fset, c.Decl)},
Syntax: syntax{Content: pkgsite.PrintType(pi.fset, c.Decl, toURL)},
})
}
for _, v := range pi.doc.Vars {
Expand All @@ -198,7 +197,7 @@ func parse(glob string, workingDir string, optionalExtraFiles []string) (*result
Type: "variable",
Summary: v.Doc,
Langs: onlyGo,
Syntax: syntax{Content: pkgsite.PrintType(pi.fset, v.Decl)},
Syntax: syntax{Content: pkgsite.PrintType(pi.fset, v.Decl, toURL)},
})
}
for _, t := range pi.doc.Types {
Expand All @@ -212,7 +211,7 @@ func parse(glob string, workingDir string, optionalExtraFiles []string) (*result
Type: "type",
Summary: t.Doc,
Langs: onlyGo,
Syntax: syntax{Content: pkgsite.PrintType(pi.fset, t.Decl)},
Syntax: syntax{Content: pkgsite.PrintType(pi.fset, t.Decl, toURL)},
Examples: processExamples(t.Examples, pi.fset),
}
// Note: items are added as page.Children, rather than
Expand All @@ -231,7 +230,7 @@ func parse(glob string, workingDir string, optionalExtraFiles []string) (*result
Type: "const",
Summary: c.Doc,
Langs: onlyGo,
Syntax: syntax{Content: pkgsite.PrintType(pi.fset, c.Decl)},
Syntax: syntax{Content: pkgsite.PrintType(pi.fset, c.Decl, toURL)},
})
}
for _, v := range t.Vars {
Expand All @@ -247,7 +246,7 @@ func parse(glob string, workingDir string, optionalExtraFiles []string) (*result
Type: "variable",
Summary: v.Doc,
Langs: onlyGo,
Syntax: syntax{Content: pkgsite.PrintType(pi.fset, v.Decl)},
Syntax: syntax{Content: pkgsite.PrintType(pi.fset, v.Decl, toURL)},
})
}

Expand Down