Skip to content

Commit 3df07ae

Browse files
Fix icon paths for docs/remote-server.md
1 parent 6e7948c commit 3df07ae

File tree

2 files changed

+28
-23
lines changed

2 files changed

+28
-23
lines changed

cmd/github-mcp-server/generate_docs.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,19 @@ func generateRemoteServerDocs(docsPath string) error {
107107
// octiconImg returns an img tag for an Octicon that works with GitHub's light/dark theme.
108108
// Uses picture element with prefers-color-scheme for automatic theme switching.
109109
// References icons from the repo's pkg/octicons/icons directory.
110-
func octiconImg(name string) string {
110+
// Optional pathPrefix for files in subdirectories (e.g., "../" for docs/).
111+
func octiconImg(name string, pathPrefix ...string) string {
111112
if name == "" {
112113
return ""
113114
}
115+
prefix := ""
116+
if len(pathPrefix) > 0 {
117+
prefix = pathPrefix[0]
118+
}
114119
// Use picture element with media queries for light/dark mode support
115120
// GitHub renders these correctly in markdown
116-
lightIcon := fmt.Sprintf("pkg/octicons/icons/%s-light.png", name)
117-
darkIcon := fmt.Sprintf("pkg/octicons/icons/%s-dark.png", name)
121+
lightIcon := fmt.Sprintf("%spkg/octicons/icons/%s-light.png", prefix, name)
122+
darkIcon := fmt.Sprintf("%spkg/octicons/icons/%s-dark.png", prefix, name)
118123
return fmt.Sprintf(`<picture><source media="(prefers-color-scheme: dark)" srcset="%s"><source media="(prefers-color-scheme: light)" srcset="%s"><img src="%s" width="20" height="20" alt="%s"></picture>`, darkIcon, lightIcon, lightIcon, name)
119124
}
120125

@@ -330,7 +335,7 @@ func generateRemoteToolsetsDoc() string {
330335
buf.WriteString("| --- | ---- | ----------- | ------- | ------------------------- | -------------- | ----------------------------------- |\n")
331336

332337
// Add "all" toolset first (special case)
333-
allIcon := octiconImg("apps")
338+
allIcon := octiconImg("apps", "../")
334339
fmt.Fprintf(&buf, "| %s | all | All available GitHub MCP tools | https://api.githubcopilot.com/mcp/ | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=github&config=%%7B%%22type%%22%%3A%%20%%22http%%22%%2C%%22url%%22%%3A%%20%%22https%%3A%%2F%%2Fapi.githubcopilot.com%%2Fmcp%%2F%%22%%7D) | [read-only](https://api.githubcopilot.com/mcp/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=github&config=%%7B%%22type%%22%%3A%%20%%22http%%22%%2C%%22url%%22%%3A%%20%%22https%%3A%%2F%%2Fapi.githubcopilot.com%%2Fmcp%%2Freadonly%%22%%7D) |\n", allIcon)
335340

336341
// AvailableToolsets() returns toolsets that have tools, sorted by ID
@@ -353,7 +358,7 @@ func generateRemoteToolsetsDoc() string {
353358
installLink := fmt.Sprintf("[Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-%s&config=%s)", idStr, installConfig)
354359
readonlyInstallLink := fmt.Sprintf("[Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-%s&config=%s)", idStr, readonlyConfig)
355360

356-
icon := octiconImg(ts.Icon)
361+
icon := octiconImg(ts.Icon, "../")
357362
fmt.Fprintf(&buf, "| %s | %s | %s | %s | %s | [read-only](%s) | %s |\n",
358363
icon,
359364
formattedName,

0 commit comments

Comments
 (0)