master @ 94 LINES
[ HISTORY ] [ UP ]
┌─ ASTRO ────────────────────────────────────────────────────────────────────┐
│ --- │
│ // Full css, not the latin-*.css variants: the standalone subset files │
│ // carry no unicode-range, and box-drawing lives in the symbols2 subset │
│ // - latin-only imports bend every frame. unicode-range means browsers │
│ // only download the subsets a page uses (latin + symbols2 here), so │
│ // the extra files cost dist size, not transfer. 500 dropped - nothing │
│ // sets it. │
│ import "@fontsource/ibm-plex-mono/400.css"; │
│ import "@fontsource/ibm-plex-mono/600.css"; │
│ import "@fontsource/ibm-plex-mono/700.css"; │
│ import "@fontsource/ibm-plex-mono/400-italic.css"; │
│ import "@fontsource/cascadia-mono/400.css"; │
│ import "@fontsource/cascadia-mono/700.css"; │
│ import "../../styles/global.scss"; │
│ import "./ArticleLayout.scss"; │
│ import Toast from "../../components/Toast/Toast.astro"; │
│ // Preloaded so the first paint sets in the real fonts - otherwise the │
│ // nav (and every frame) paints a few px off in fallback metrics, then │
│ // snaps when the woff2 arrives: visible jitter on each navigation. │
│ import cascadia400 from "@fontsource/cascadia-mono/files/cascadia-mono-latin-400-n │
│ ormal.woff2?url"; │
│ import cascadia700 from "@fontsource/cascadia-mono/files/cascadia-mono-latin-700-n │
│ ormal.woff2?url"; │
│ import cascadiaSym from "@fontsource/cascadia-mono/files/cascadia-mono-symbols2-40 │
│ 0-normal.woff2?url"; │
│ import plex400 from "@fontsource/ibm-plex-mono/files/ibm-plex-mono-latin-400-norma │
│ l.woff2?url"; │
│ import plex600 from "@fontsource/ibm-plex-mono/files/ibm-plex-mono-latin-600-norma │
│ l.woff2?url"; │
│ // symbols2 carries the box-drawing glyphs - every frame needs it at │
│ // first paint just as much as latin. │
│ const preloadFonts = [cascadia400, cascadia700, cascadiaSym, plex400, plex600]; │
│ const { │
│ title = "OOKNET KB", │
│ description = "OOKNET knowledge base - a text-mode wiki of filed notes, docs, an │
│ d references, rendered on a strict ASCII grid.", │
│ type = "website", │
│ } = Astro.props; │
│ const canonical = new URL(Astro.url.pathname, Astro.site); │
│ --- │
│ <!doctype html> │
│ <html lang="en"> │
│ <head> │
│ <meta charset="utf-8" /> │
│ <meta name="viewport" content="width=device-width, initial-scale=1" /> │
│ <link rel="icon" type="image/svg+xml" href="/favicon.svg" /> │
│ {preloadFonts.map((href) => ( │
│ <link rel="preload" as="font" type="font/woff2" crossorigin href={href} /> │
│ ))} │
│ <title>{title}</title> │
│ <meta name="description" content={description} /> │
│ <link rel="canonical" href={canonical} /> │
│ <meta property="og:site_name" content="OOKNET KB" /> │
│ <meta property="og:type" content={type} /> │
│ <meta property="og:title" content={title} /> │
│ <meta property="og:description" content={description} /> │
│ <meta property="og:url" content={canonical} /> │
│ <meta name="twitter:card" content="summary" /> │
│ <link rel="alternate" type="application/rss+xml" title="OOKNET KB" href="/rss. │
│ xml" /> │
│ <script is:inline> │
│ (() => { │
│ try { │
│ const stored = localStorage.getItem("theme"); │
│ const theme = stored || (matchMedia("(prefers-color-scheme: dark)").matc │
│ hes ? "dark" : "light"); │
│ document.documentElement.setAttribute("data-theme", theme); │
│ } catch { document.documentElement.setAttribute("data-theme", "light"); } │
│ })(); │
│ </script> │
│ </head> │
│ <body> │
│ <div class="page"> │
│ <slot /> │
│ </div> │
│ <Toast /> │
│ <script is:inline> │
│ document.addEventListener("click", async (e) => { │
│ const copyBtn = e.target.closest(".code-copy"); │
│ if (copyBtn) { │
│ const pre = copyBtn.closest("pre"); │
│ const raw = pre?.dataset.rawCode; │
│ if (!raw) return; │
│ try { │
│ await navigator.clipboard.writeText(raw); │
│ copyBtn.textContent = "[ DONE ]"; │
│ setTimeout(() => { copyBtn.textContent = "[ COPY ]"; }, 1200); │
│ } catch {} │
│ return; │
│ } │
│ const themeBtn = e.target.closest(".theme-toggle"); │
│ if (themeBtn) { │
│ const cur = document.documentElement.getAttribute("data-theme") === "dar │
│ k" ? "dark" : "light"; │
│ const next = cur === "dark" ? "light" : "dark"; │
│ document.documentElement.setAttribute("data-theme", next); │
│ try { localStorage.setItem("theme", next); } catch {} │
│ } │
│ }); │
│ </script> │
│ </body> │
│ </html> │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ ASTRO ──────────────────────────────┐
│ --- │
│ // Full css, not the latin-*.css variants: t │
│ he standalone subset files │
│ // carry no unicode-range, and box-drawing l │
│ ives in the symbols2 subset │
│ // - latin-only imports bend every frame. un │
│ icode-range means browsers │
│ // only download the subsets a page uses (la │
│ tin + symbols2 here), so │
│ // the extra files cost dist size, not trans │
│ fer. 500 dropped - nothing │
│ // sets it. │
│ import "@fontsource/ibm-plex-mono/400.css"; │
│ import "@fontsource/ibm-plex-mono/600.css"; │
│ import "@fontsource/ibm-plex-mono/700.css"; │
│ import "@fontsource/ibm-plex-mono/400-italic │
│ .css"; │
│ import "@fontsource/cascadia-mono/400.css"; │
│ import "@fontsource/cascadia-mono/700.css"; │
│ import "../../styles/global.scss"; │
│ import "./ArticleLayout.scss"; │
│ import Toast from "../../components/Toast/To │
│ ast.astro"; │
│ // Preloaded so the first paint sets in the │
│ real fonts - otherwise the │
│ // nav (and every frame) paints a few px off │
│ in fallback metrics, then │
│ // snaps when the woff2 arrives: visible jit │
│ ter on each navigation. │
│ import cascadia400 from "@fontsource/cascadi │
│ a-mono/files/cascadia-mono-latin-400-normal. │
│ woff2?url"; │
│ import cascadia700 from "@fontsource/cascadi │
│ a-mono/files/cascadia-mono-latin-700-normal. │
│ woff2?url"; │
│ import cascadiaSym from "@fontsource/cascadi │
│ a-mono/files/cascadia-mono-symbols2-400-norm │
│ al.woff2?url"; │
│ import plex400 from "@fontsource/ibm-plex-mo │
│ no/files/ibm-plex-mono-latin-400-normal.woff │
│ 2?url"; │
│ import plex600 from "@fontsource/ibm-plex-mo │
│ no/files/ibm-plex-mono-latin-600-normal.woff │
│ 2?url"; │
│ // symbols2 carries the box-drawing glyphs - │
│ every frame needs it at │
│ // first paint just as much as latin. │
│ const preloadFonts = [cascadia400, cascadia7 │
│ 00, cascadiaSym, plex400, plex600]; │
│ const { │
│ title = "OOKNET KB", │
│ description = "OOKNET knowledge base - a t │
│ ext-mode wiki of filed notes, docs, and refe │
│ rences, rendered on a strict ASCII grid.", │
│ type = "website", │
│ } = Astro.props; │
│ const canonical = new URL(Astro.url.pathname │
│ , Astro.site); │
│ --- │
│ <!doctype html> │
│ <html lang="en"> │
│ <head> │
│ <meta charset="utf-8" /> │
│ <meta name="viewport" content="width=dev │
│ ice-width, initial-scale=1" /> │
│ <link rel="icon" type="image/svg+xml" hr │
│ ef="/favicon.svg" /> │
│ {preloadFonts.map((href) => ( │
│ <link rel="preload" as="font" type="fo │
│ nt/woff2" crossorigin href={href} /> │
│ ))} │
│ <title>{title}</title> │
│ <meta name="description" content={descri │
│ ption} /> │
│ <link rel="canonical" href={canonical} / │
│ > │
│ <meta property="og:site_name" content="O │
│ OKNET KB" /> │
│ <meta property="og:type" content={type} │
│ /> │
│ <meta property="og:title" content={title │
│ } /> │
│ <meta property="og:description" content= │
│ {description} /> │
│ <meta property="og:url" content={canonic │
│ al} /> │
│ <meta name="twitter:card" content="summa │
│ ry" /> │
│ <link rel="alternate" type="application/ │
│ rss+xml" title="OOKNET KB" href="/rss.xml" / │
│ > │
│ <script is:inline> │
│ (() => { │
│ try { │
│ const stored = localStorage.getIte │
│ m("theme"); │
│ const theme = stored || (matchMedi │
│ a("(prefers-color-scheme: dark)").matches ? │
│ "dark" : "light"); │
│ document.documentElement.setAttrib │
│ ute("data-theme", theme); │
│ } catch { document.documentElement.s │
│ etAttribute("data-theme", "light"); } │
│ })(); │
│ </script> │
│ </head> │
│ <body> │
│ <div class="page"> │
│ <slot /> │
│ </div> │
│ <Toast /> │
│ <script is:inline> │
│ document.addEventListener("click", asy │
│ nc (e) => { │
│ const copyBtn = e.target.closest(".c │
│ ode-copy"); │
│ if (copyBtn) { │
│ const pre = copyBtn.closest("pre") │
│ ; │
│ const raw = pre?.dataset.rawCode; │
│ if (!raw) return; │
│ try { │
│ await navigator.clipboard.writeT │
│ ext(raw); │
│ copyBtn.textContent = "[ DONE ]" │
│ ; │
│ setTimeout(() => { copyBtn.textC │
│ ontent = "[ COPY ]"; }, 1200); │
│ } catch {} │
│ return; │
│ } │
│ const themeBtn = e.target.closest(". │
│ theme-toggle"); │
│ if (themeBtn) { │
│ const cur = document.documentEleme │
│ nt.getAttribute("data-theme") === "dark" ? " │
│ dark" : "light"; │
│ const next = cur === "dark" ? "lig │
│ ht" : "dark"; │
│ document.documentElement.setAttrib │
│ ute("data-theme", next); │
│ try { localStorage.setItem("theme" │
│ , next); } catch {} │
│ } │
│ }); │
│ </script> │
│ </body> │
│ </html> │
└──────────────────────────────────────────────┘
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET