-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsource.config.ts
More file actions
55 lines (46 loc) · 1.54 KB
/
source.config.ts
File metadata and controls
55 lines (46 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
* ObjectDocs
* Copyright (c) 2026-present ObjectStack Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { defineConfig, defineDocs, frontmatterSchema, metaSchema } from 'fumadocs-mdx/config';
import { siteConfig } from './lib/site-config';
import path from 'node:path';
import fs from 'node:fs';
import remarkDirective from 'remark-directive';
import { remarkDirectiveAdmonition } from 'fumadocs-core/mdx-plugins';
function resolveContentDir(dir: string) {
if (process.env.DOCS_DIR && dir === 'content/docs') return process.env.DOCS_DIR;
// Try local first (Root deployment)
if (fs.existsSync(path.resolve(dir))) return dir;
// Try parent (Monorepo/Vercel deployment where CWD is packages/site)
const parentDir = path.join('../..', dir);
if (fs.existsSync(path.resolve(parentDir))) return parentDir;
return dir;
}
const docsDir = resolveContentDir('content/docs');
// You can customise Zod schemas for frontmatter and meta.json here
// see https://fumadocs.dev/docs/mdx/collections
export const docs = defineDocs({
dir: docsDir,
docs: {
schema: frontmatterSchema,
postprocess: {
// Required for LLM text generation (getLLMText in lib/source.ts)
includeProcessedMarkdown: true,
},
},
meta: {
schema: metaSchema,
},
});
export default defineConfig({
mdxOptions: {
remarkPlugins: [remarkDirective, remarkDirectiveAdmonition],
rehypeCodeOptions: {
theme: siteConfig.content.codeBlock.theme,
}
}
});