/** * TypeDoc plugin that applies MCP-specific styling tweaks. * * - Moves custom.css to load last so overrides win the cascade * - Replaces breadcrumbs with the document group name (e.g. "Security") * - Marks the current sidebar nav link for CSS highlighting * - Rewrites the README logo to a pair of theme-tagged s so * the logo follows the TypeDoc theme switcher (data-theme), not just the * OS prefers-color-scheme media query */ import { Renderer } from "typedoc"; /** * TypeDoc plugin entry point. * @param {import('typedoc').Application} app */ export function load(app) { app.renderer.on(Renderer.EVENT_END_PAGE, (page) => { if (!page.contents) return; // Move custom.css to load after all theme stylesheets so overrides win the cascade const customCssLink = page.contents.match( //, ); if (customCssLink) { page.contents = page.contents.replace(customCssLink[0], ""); page.contents = page.contents.replace( "", customCssLink[0] + "\n", ); } // For document pages, replace the breadcrumb with the group name // (e.g. "Security", "Getting Started"). The page title is in the H1. if (page.model?.isDocument?.() && page.model.frontmatter?.group) { const group = String(page.model.frontmatter.group); page.contents = page.contents.replace( /