--- /** * Notebook-paper page header: a category sticker, breadcrumbs, the title in * the display font, the description and (for method pages) the source package. */ import { categories } from "../data/categories"; import { pagesBySlug } from "../data/pages"; const { entry, id: slug } = Astro.locals.starlightRoute; const { title, description, category, method, plugin } = entry.data; const base = import.meta.env.BASE_URL.replace(/\/$/, ""); interface Crumb { label: string; href?: string; } let tab = "Docs"; let color = "var(--jp-yellow)"; const crumbs: Crumb[] = [{ label: "Docs", href: `${base}/` }]; if (category) { tab = categories[category].label; color = categories[category].color; crumbs.push({ label: "Methods", href: `${base}/methods/` }, { label: tab }); } else if (slug === "methods") { tab = "API"; color = "var(--jp-mint)"; crumbs.push({ label: "Methods" }); } else if (slug.startsWith("guides/") || slug.startsWith("concepts/")) { const isGuide = slug.startsWith("guides/"); tab = isGuide ? "Guide" : "Concept"; color = pagesBySlug.get(slug)?.color ?? color; crumbs.push({ label: isGuide ? "Guides" : "Concepts" }); } else if (slug.startsWith("api/")) { tab = "Type reference"; color = "#c9a8ff"; crumbs.push({ label: "Type reference", href: `${base}/api/readme/` }); } else if (slug === "playground") { tab = "Playground"; color = "var(--jp-pink)"; } else if (slug === "404") { tab = "404"; color = "var(--jp-orange)"; } const sourcePath = plugin?.replace(/^@jimp\//, ""); const sourceDir = sourcePath && (/^(core|utils|diff)$/.test(sourcePath) ? "packages" : "plugins"); ---
{description}
} { plugin && (
From
{plugin}