Files
wehub-resource-sync e30e75b5d4
Changesets / Create Version PR (push) Has been cancelled
Deploy Shadcn Registry / Deploy Production (push) Has been cancelled
Template Metrics / LOC + Bundle Size (push) Has been cancelled
Code Quality / Oxlint + Oxfmt (push) Has been cancelled
Code Quality / Template Sync (push) Has been cancelled
Code Quality / Build Changed Packages (push) Has been cancelled
Code Quality / Test Changed Packages (push) Has been cancelled
Deploy Expo Example / Deploy Production (push) Has been cancelled
Deploy Ink Example / Deploy Production (push) Has been cancelled
Python Tests / pytest (assistant-stream, 3.10) (push) Has been cancelled
Python Tests / pytest (assistant-stream, 3.12) (push) Has been cancelled
Python Tests / pytest (assistant-ui-sync-server-api, 3.10) (push) Has been cancelled
Python Tests / pytest (assistant-ui-sync-server-api, 3.12) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:40:13 +08:00

123 lines
2.9 KiB
TypeScript

import {
defineConfig,
defineDocs,
defineCollections,
frontmatterSchema,
metaSchema,
} from "fumadocs-mdx/config";
import { rehypeCodeDefaultOptions } from "fumadocs-core/mdx-plugins";
import { transformerMetaHighlight } from "@shikijs/transformers";
import { z } from "zod";
import lastModified from "fumadocs-mdx/plugins/last-modified";
import type { ShikiTransformer } from "shiki";
import { remarkMermaid } from "./lib/remark-mermaid";
function transformerLineNumbers(): ShikiTransformer {
return {
name: "line-numbers",
pre(node) {
node.properties["data-line-numbers"] = "";
},
};
}
// Platform a doc page or section applies to. Used by the docs sidebar to
// filter content based on the user's selected platform in the header dropdown.
// Pages / folders with no `platforms` field are universal.
// fumadocs-mdx forbids non-collection exports here, so this is local-only.
const platformSchema = z.enum(["react", "rn", "ink"]);
export const docs = defineDocs({
docs: {
schema: frontmatterSchema.extend({
links: z
.array(
z.object({
label: z.string(),
url: z.string(),
}),
)
.optional(),
platforms: z.array(platformSchema).optional(),
}),
postprocess: {
includeProcessedMarkdown: true,
},
},
meta: {
schema: metaSchema.extend({
description: z.string().optional(),
overview: z.string().optional(),
platforms: z.array(platformSchema).optional(),
}),
},
});
export const tapDocs = defineDocs({
dir: "content/tap-docs",
docs: {
schema: frontmatterSchema,
postprocess: {
includeProcessedMarkdown: true,
},
},
meta: {
schema: metaSchema.extend({
description: z.string().optional(),
}),
},
});
export const examples = defineCollections({
type: "doc",
dir: "content/examples",
schema: frontmatterSchema,
postprocess: {
includeProcessedMarkdown: true,
},
});
export const blog = defineCollections({
type: "doc",
dir: "content/blog",
schema: frontmatterSchema.extend({
author: z.string(),
date: z.date().optional(),
}),
postprocess: {
includeProcessedMarkdown: true,
},
});
export const careers = defineCollections({
type: "doc",
dir: "content/careers",
schema: frontmatterSchema.extend({
order: z.number().optional(),
location: z.string(),
type: z.string(),
salary: z.string(),
summary: z.string(),
}),
});
export default defineConfig({
plugins: [lastModified()],
mdxOptions: {
remarkPlugins: [remarkMermaid],
rehypeCodeOptions: {
lazy: true,
langs: ["ts", "js", "html", "tsx", "mdx", "bash"],
themes: {
light: "catppuccin-latte",
dark: "catppuccin-mocha",
},
transformers: [
...(rehypeCodeDefaultOptions.transformers ?? []),
transformerLineNumbers(),
transformerMetaHighlight(),
],
},
},
});