- 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
23 lines
735 B
JavaScript
23 lines
735 B
JavaScript
// SummerCMS docs: applies the stored colour theme before first paint.
|
|
// Loaded synchronously in <head>, before the stylesheet. "system" (the
|
|
// default) sets neither class and lets prefers-color-scheme decide.
|
|
(function () {
|
|
"use strict";
|
|
var root = document.documentElement;
|
|
var theme = "system";
|
|
try {
|
|
var stored = window.localStorage.getItem("summer-docs-theme");
|
|
if (stored === "light" || stored === "dark") {
|
|
theme = stored;
|
|
}
|
|
} catch (e) {
|
|
// Storage is unavailable (private mode, disabled): behave as system.
|
|
}
|
|
root.classList.add("js");
|
|
root.classList.remove("light", "dark");
|
|
if (theme !== "system") {
|
|
root.classList.add(theme);
|
|
}
|
|
root.setAttribute("data-theme", theme);
|
|
})();
|