-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsource.config.ts
More file actions
109 lines (105 loc) · 2.86 KB
/
Copy pathsource.config.ts
File metadata and controls
109 lines (105 loc) · 2.86 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import {
rehypeCodeDefaultOptions,
remarkDirectiveAdmonition,
} from 'fumadocs-core/mdx-plugins';
import { applyMdxPreset, defineConfig, defineDocs } from 'fumadocs-mdx/config';
import remarkDirective from 'remark-directive';
import { z } from 'zod';
import { createScopedDocsFiles } from './src/lib/docs-dev-scope';
import { docsMetaSchema } from './src/lib/docs-meta-schema';
import { directiveCalloutTypes } from './src/lib/mdx/directive-callouts';
import { remarkTableSlots } from './src/lib/mdx/remark-table-slots';
import { remarkPlatformContent } from './src/lib/platforms/remark-platform-content';
const useDynamicDocsRuntime =
process.env.FUMADOCS_STATIC_PAYLOAD_DYNAMIC === 'true';
const scopedDocsFiles = createScopedDocsFiles(process.env.DOCS_DEV_SCOPE ?? '');
const rawDocSchema = z.object({
title: z.string().optional(),
description: z.string().optional(),
icon: z.string().optional(),
hidePlatformTabs: z.boolean().optional(),
hideToc: z.boolean().optional(),
layout: z.enum(['platform-group']).optional(),
platforms: z.array(z.string()).optional(),
defaultPlatform: z.string().optional(),
_openapi: z.looseObject({}).optional(),
});
export const docs = defineDocs({
dir: 'content/docs',
docs: {
async: true,
dynamic: useDynamicDocsRuntime,
files: scopedDocsFiles?.docs ?? ['**/*.{md,mdx}'],
schema: rawDocSchema,
mdxOptions: applyMdxPreset({
rehypeCodeOptions: {
...rehypeCodeDefaultOptions,
langs: [
'bash',
'cpp',
'csharp',
'css',
'dart',
'go',
'html',
'java',
'javascript',
'json',
'kotlin',
'markdown',
'objc',
'php',
'python',
'ruby',
'sh',
'swift',
'ts',
'tsx',
'typescript',
'xml',
'yaml',
],
langAlias: {
...rehypeCodeDefaultOptions.langAlias,
curl: 'bash',
js: 'javascript',
md: 'markdown',
objectivec: 'objc',
text: 'bash',
txt: 'bash',
},
fallbackLanguage: 'bash',
lazy: false,
},
remarkImageOptions: {
external: false,
onError: 'ignore',
useImport: false,
},
remarkCodeTabOptions: {
Tabs: 'CodeBlockTabs',
parseMdx: true,
},
remarkPlugins: (plugins) => [
remarkDirective,
[
remarkDirectiveAdmonition,
{
types: directiveCalloutTypes,
},
],
remarkPlatformContent,
remarkTableSlots,
...plugins,
],
}),
postprocess: {
includeProcessedMarkdown: true,
},
},
meta: {
files: scopedDocsFiles?.meta ?? ['**/meta.{json,yaml}'],
schema: docsMetaSchema,
},
});
export default defineConfig();