Squidoc

编写插件

Squidoc 是一个静态优先的文档平台,内置插件系统、主题系统和面向 SEO 的默认配置。你可以编写 Markdown,通过 docs.config.ts 配置项目,并发布快速的静态站点。

项目结构

文档文章放在 docs/,可选 Astro 页面放在 pages/,docs.config.ts 连接站点元数据、导航、插件和主题。

扩展

插件可以添加搜索、SEO、代码块、版本管理、国际化和生成文件。主题控制布局、导航和插件插槽。

验证

部署前运行 npm run check、npm run build 和 npm run preview。

编写插件

此页面与英文文档保持对应,确保所有支持的语言在当前版本中拥有相同的文档覆盖范围。

快速开始 · 配置 · 插件 · 主题 · 部署

参考示例

import { definePlugin } from "@squidoc/core";

export default definePlugin({
  name: "@acme/squidoc-plugin-example",
  setup(api) {
    const message =
      typeof api.pluginOptions.message === "string"
        ? api.pluginOptions.message
        : "Generated during squidoc build.";

    api.addGeneratedFile({
      path: "example.txt",
      contents: `${message}\n`,
    });
  },
});
plugins: [
  {
    name: "@acme/squidoc-plugin-example",
    options: {
      message: "Generated from plugin options.",
    },
  },
];
api.addThemeSlot({
  name: "search",
  component: "@squidoc/plugin-search/Search.astro",
  html: "<div data-squidoc-search>...</div>",
});