aboutsummaryrefslogtreecommitdiff
path: root/cmd/golangorg/server.go
diff options
context:
space:
mode:
authorAlan Donovan <adonovan@google.com>2025-07-29 17:33:58 -0400
committerGopher Robot <gobot@golang.org>2025-07-29 21:59:14 -0700
commit5d1a360630bf087e66d51814b3410f2a1baace5b (patch)
tree07fa60a58f2c074abd9d8fa7fa2f2034c9e35482 /cmd/golangorg/server.go
parente5dd27fc71edea3015b34b5061a4f4fe6e86f0cc (diff)
downloadgo-x-website-5d1a360630bf087e66d51814b3410f2a1baace5b.tar.xz
_content/css: style tables produced from markdown
We emit a <div class=markdown> around the whole output of goldmark, so that CSS style rules can easily select them (without affecting HTML tables in the spec, for example). The default style for markdown tables now has thin grey lines, grey headings, and a little padding. Also, remove the FS middleware used to inject default.tmpl into x/tools/gopls/doc, since that file is now actually present. And add it to the fake data at _content/gopls/doc. Fixes golang/go#67368 Change-Id: If91e702c394d73a181bd780711e8be6f661f2e59 Reviewed-on: https://go-review.googlesource.com/c/website/+/691616 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Auto-Submit: Alan Donovan <adonovan@google.com>
Diffstat (limited to 'cmd/golangorg/server.go')
-rw-r--r--cmd/golangorg/server.go29
1 files changed, 1 insertions, 28 deletions
diff --git a/cmd/golangorg/server.go b/cmd/golangorg/server.go
index 71218c05..17d55a3f 100644
--- a/cmd/golangorg/server.go
+++ b/cmd/golangorg/server.go
@@ -28,7 +28,6 @@ import (
"strings"
"sync"
"sync/atomic"
- "testing/fstest"
"time"
"cloud.google.com/go/datastore"
@@ -320,26 +319,7 @@ func addGopls(contentFS fs.FS, ref string) fs.FS {
go watchGit(&toolsFS, "https://go.googlesource.com/tools", ref)
}
- // Inject gopls/doc/default.tmpl into the FS, since
- // unlike wiki, x/tools/gopls/doc doesn't have the
- // default.tmpl needed by the markdown renderer.
- // TODO(adonovan): remove once CL 686595 has been released in gopls/v0.20.0.
- overlay := fstest.MapFS{
- "gopls/doc/default.tmpl": {
- Data: []byte(`
-{{define "layout"}}
-{{doclayout .}}
-{{end}})}`[1:]),
- },
- }
- tools2FS := fnFS(func(name string) (fs.File, error) {
- if _, ok := overlay[name]; ok {
- return overlay.Open(name)
- }
- return toolsFS.Open(name) // delegate
- })
-
- goplsDocFS, err := fs.Sub(tools2FS, "gopls/doc")
+ goplsDocFS, err := fs.Sub(&toolsFS, "gopls/doc")
if err != nil {
log.Fatalf("can't restrict to gopls/doc tree: %v", err)
}
@@ -1031,10 +1011,3 @@ func jsonUnmarshal(data []byte) (any, error) {
err := json.Unmarshal(data, &x)
return x, err
}
-
-// A fnFS is a closure that defines an [fs.FS].
-type fnFS func(name string) (fs.File, error)
-
-var _ fs.FS = fnFS(nil)
-
-func (f fnFS) Open(name string) (fs.File, error) { return f(name) }