@timmo001/docs-kit

中文文档
0.9.33发布于 2026/11/03Apache-2.0ES Module构建来源已验证

Shared branding, layout and config for timmo001 documentation sites

原始使用文档
文档目录7 节
  1. Install
  2. Blume
  3. Config
  4. Components
  5. Theme
  6. Brand images
  7. Development

@timmo001/docs-kit

Shared branding, layout and config for my documentation sites.

The root export renders brand images and doesn't depend on a docs tool. The blume export holds the Blume parts: a config helper, a home page banner, a header GitHub link and a layout stylesheet. If the sites move off Blume, the root export stays and a new tool gets its own entry point.

Install

bun add -E @timmo001/docs-kit

The blume export needs the blume version in peerDependencies.

Blume

Config

docsConfig returns a full Blume config from the site details. Pass anything else Blume accepts alongside them; it overrides the default it replaces, and markdown, navigation and seo merge one level deep.

import { docsConfig } from "@timmo001/docs-kit/blume";
import { defineConfig } from "blume";

export default defineConfig(
  docsConfig({
    title: "Triage",
    description: "Pull request triage from the terminal.",
    site: "triage.timmo.dev",
    github: { owner: "timmo001", repo: "triage" },
    navigation: {
      sidebar: ["/", "/getting-started"],
    },
  }),
);

The defaults:

  • Light and dark logos from public/logo-light.svg and public/logo-dark.svg, with the title as the logo text.
  • Content in src/content/docs, last-modified dates from git and external links opening in a new tab.
  • GitHub's high-contrast code themes, since the default ones miss WCAG AA on comments and keywords. Set markdown.code.theme to change them.
  • Cloudflare deployment to https://<site>.
  • llms.txt, the MCP endpoint at /mcp, WebMCP and agent readability on. Ask AI and page feedback off.
  • GitHub branch set to main and dir to docs, plus the header repository link.
  • Generated share cards using src/assets/logo.svg, and an organisation logo at /logo.png (see Brand images).

Components

Blume reads components.ts without running it, so import the components there directly:

import HeaderSearch from "@timmo001/docs-kit/blume/header-search.astro";
import HomeBanner from "@timmo001/docs-kit/blume/home-banner.astro";
import { defineComponents } from "blume";

export default defineComponents({
  layout: {
    PageHeader: HomeBanner,
    Search: HeaderSearch,
  },
});
  • HomeBanner shows the logo, title and description across the top of the home page and hides the page's own heading and lede. Other pages render nothing.
  • HeaderSearch keeps Blume's search and adds a GitHub link after it when the config has a repository.

Both use scoped CSS, so they don't rely on Tailwind scanning node_modules.

Theme

Import the layout styles from the site's theme.css:

@import "@timmo001/docs-kit/blume/theme.css";

This widens the content column on large screens and keeps the "On this page" rail next to the content. The banner's full-width layout relies on these columns.

Then import the Groundwork theme of the app the site documents, such as Base, Glazing, Survey, Slate, Bridge or Snag:

@import "@timmo001/docs-kit/blume/themes/bridge.css";

It sets Blume's colors, radius and fonts from the theme in light, dark and Darker, so leave theme.accent out of blume.config.ts. The fonts are stacks, so load the theme's font files in theme.css too, for example with @import "@fontsource-variable/inter";. Use Base until the app has a theme of its own.

HeaderSearch adds a mode picker next to Blume's light and dark toggle, with Light, Dark and Darker. To let readers pick the theme as well, import every theme after the site's default and pass the themes to HeaderSearch from a wrapper component:

@import "@timmo001/docs-kit/blume/themes/base.css";
@import "@timmo001/docs-kit/blume/themes/all.css";
---
import HeaderSearch from "@timmo001/docs-kit/blume/header-search.astro";

const themes = [
  { id: "base", name: "Base" },
  { id: "bridge", name: "Bridge" },
];
---

<HeaderSearch {...Astro.props} themes={themes} defaultTheme="base" />

Set these in theme.css to change the banner:

.home-banner {
  --home-banner-logo-size: 20rem;
  --home-banner-height: 30rem;
  --home-banner-background: #e4e4e7;
  --home-banner-background-dark: #09090b;
}

Brand images

writeBrandImages renders PNGs from a square SVG logo with a viewBox: Open Graph and GitHub social preview cards, a 512px logo and an Apple touch icon. Leave an output out to skip it.

import { writeBrandImages } from "@timmo001/docs-kit";

await writeBrandImages({
  logo: "src/assets/logo.svg",
  title: "Triage",
  tagline: ["Pull request triage", "from the terminal."],
  site: "triage.timmo.dev",
  background: "#18181b",
  accent: "#d97706",
  outputs: {
    socialPreview: "../.github/social-preview.png",
    logo: "public/logo.png",
    appleTouchIcon: "public/apple-touch-icon.png",
  },
});

Blume makes its own per-page share cards, so a Blume site only needs og for links outside the docs. GitHub doesn't read the social preview from the repository; upload it under the repository settings.

Development

See the repository README.

版本与发布记录

@timmo001/docs-kit 共发布 49 个版本,首次发布于 2026/10/07;过去 12 个月发布了 49 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.9.33latest2026/11/03今天
0.9.322026/11/021 天前
0.9.312026/11/021 天前
0.9.302026/11/021 天前
0.9.292026/11/021 天前
0.9.282026/11/021 天前

关于 @timmo001/docs-kit 的常见问题

@timmo001/docs-kit 是什么?

timmo001文档站点的共享品牌、布局和配置

如何安装 @timmo001/docs-kit?

在项目目录运行 npm install @timmo001/docs-kit,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:blume(2.2.6)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@timmo001/docs-kit 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/timmo001__docs-kit 是否存在。

@timmo001/docs-kit 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@timmo001/docs-kit 可以商用吗?

@timmo001/docs-kit 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@timmo001/docs-kit 还在维护吗?

最新版本 0.9.33 发布于 2026/11/03(今天);至今共发布 49 个版本,其中过去 12 个月发布了 49 个;首次发布于 2026/10/07。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。