Pages deploy ux a11y refresh (#1252)

* Improve Pages workflow and redesign site with accessible sidebar navigation

* README clean up

* Use Makefile website target in Pages deploy workflow
This commit is contained in:
Julien Bisconti
2026-02-28 12:13:59 +01:00
committed by GitHub
parent 26e2d664ec
commit 05266bd8ac
8 changed files with 655 additions and 117 deletions

View File

@@ -8,6 +8,7 @@ import (
"github.com/yuin/goldmark"
"github.com/yuin/goldmark/extension"
"github.com/yuin/goldmark/parser"
"github.com/yuin/goldmark/renderer/html"
)
@@ -27,6 +28,7 @@ func Build(markdownPath, templatePath, outputPath string) error {
// Convert markdown to HTML
gm := goldmark.New(
goldmark.WithExtensions(extension.GFM),
goldmark.WithParserOptions(parser.WithAutoHeadingID()),
goldmark.WithRendererOptions(html.WithUnsafe()),
)
var buf bytes.Buffer

View File

@@ -131,3 +131,42 @@ func TestBuildFailsWithoutPlaceholder(t *testing.T) {
t.Fatal("expected Build to fail when template has no supported placeholder")
}
}
func TestBuildAddsHeadingIDs(t *testing.T) {
dir := t.TempDir()
md := "# Getting Started\n\n## Next Step\n"
mdPath := filepath.Join(dir, "README.md")
if err := os.WriteFile(mdPath, []byte(md), 0o644); err != nil {
t.Fatal(err)
}
tmpl := `<!DOCTYPE html>
<html>
<body>
<section id="md" class="main-content"></section>
</body>
</html>`
tmplPath := filepath.Join(dir, "template.html")
if err := os.WriteFile(tmplPath, []byte(tmpl), 0o644); err != nil {
t.Fatal(err)
}
outPath := filepath.Join(dir, "index.html")
if err := Build(mdPath, tmplPath, outPath); err != nil {
t.Fatalf("Build failed: %v", err)
}
content, err := os.ReadFile(outPath)
if err != nil {
t.Fatal(err)
}
html := string(content)
if !strings.Contains(html, `id="getting-started"`) {
t.Error("expected auto-generated heading id for h1")
}
if !strings.Contains(html, `id="next-step"`) {
t.Error("expected auto-generated heading id for h2")
}
}