feat(11.1-02): add the documentation theme, chroma highlighting and docs:serve
- WinterCMS-style shell: header with search and theme toggle, grouped sidebar, on-page TOC, pager, page actions, callouts, heading permalinks, footer and a 404 page - fenced code highlighted at build time by chroma/v2 into tok-* classes, with a copy button; no inline script, style or handler - vendored DM Sans/DM Mono fonts and Lucide icons with their licences - client-side search over search-index.json built with textContent only - summer docs:serve builds into a temp dir, serves on loopback by default, returns 404.html with status 404 and rebuilds on change
This commit is contained in:
@@ -1,32 +1,62 @@
|
||||
{{define "head" -}}
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="color-scheme" content="light dark">
|
||||
<title>{{.DocTitle}}</title>
|
||||
<meta name="description" content="{{.Description}}">
|
||||
<meta property="og:title" content="{{.Title}}">
|
||||
<meta property="og:description" content="{{.Description}}">
|
||||
{{- if .MarkdownURL}}
|
||||
<link rel="alternate" type="text/markdown" href="{{.MarkdownURL}}">
|
||||
{{- end}}
|
||||
<script src="{{.Assets}}/theme-init.js"></script>
|
||||
<link rel="stylesheet" href="{{.Assets}}/site.css">
|
||||
<script src="{{.Assets}}/site.js" defer></script>
|
||||
<script src="{{.Assets}}/search.js" defer></script>
|
||||
{{- end -}}
|
||||
{{define "shell-start" -}}
|
||||
<a class="skip-link" href="#content">Skip to content</a>
|
||||
{{template "header" .}}
|
||||
<div class="layout">
|
||||
{{template "sidebar" .}}
|
||||
<div class="scrim" hidden></div>
|
||||
{{- end -}}
|
||||
{{define "shell-end" -}}
|
||||
</div>
|
||||
{{template "search" .}}
|
||||
<div class="sr-only" id="live-region" aria-live="polite"></div>
|
||||
{{- end -}}
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{{.DocTitle}}</title>
|
||||
<meta name="description" content="{{.Description}}">
|
||||
<link rel="stylesheet" href="{{.CSS}}">
|
||||
{{template "head" .}}
|
||||
</head>
|
||||
<body class="docs">
|
||||
<div class="layout">
|
||||
<nav class="sidebar" aria-label="Documentation">
|
||||
<a class="sidebar-home" href="{{.HomeURL}}">SummerCMS</a>
|
||||
{{- range .Nav}}
|
||||
<div class="sidebar-section">
|
||||
<p class="sidebar-title">{{.Title}}</p>
|
||||
<ul>
|
||||
{{- range .Items}}
|
||||
<li><a href="{{.URL}}"{{if .Current}} aria-current="page"{{end}}>{{.Title}}</a></li>
|
||||
{{template "shell-start" .}}
|
||||
<main id="content" tabindex="-1">
|
||||
<div class="page{{if .TOC}} has-toc{{end}}">
|
||||
<article class="page-body">
|
||||
{{- if .Eyebrow}}
|
||||
<p class="eyebrow">{{.Eyebrow}}</p>
|
||||
{{- end}}
|
||||
</ul>
|
||||
</div>
|
||||
{{- end}}
|
||||
</nav>
|
||||
<main id="content">
|
||||
<h1>{{.Title}}</h1>
|
||||
<p class="lead">{{.Description}}</p>
|
||||
{{.Content}}
|
||||
</main>
|
||||
<div class="page-actions">
|
||||
{{- if .EditURL}}
|
||||
<a href="{{.EditURL}}">{{template "icon-pencil"}}<span>Edit this page</span></a>
|
||||
{{- end}}
|
||||
<a href="{{.MarkdownURL}}">{{template "icon-file-text"}}<span>View as Markdown</span></a>
|
||||
</div>
|
||||
{{template "toc-inline" .}}
|
||||
<div class="prose">
|
||||
{{.Content}}
|
||||
</div>
|
||||
{{template "pager" .}}
|
||||
</article>
|
||||
{{template "toc" .}}
|
||||
</div>
|
||||
{{template "footer" .}}
|
||||
</main>
|
||||
{{template "shell-end" .}}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user