-
Notifications
You must be signed in to change notification settings - Fork 79
Expand file tree
/
Copy pathsource.config.ts
More file actions
74 lines (72 loc) · 2.49 KB
/
Copy pathsource.config.ts
File metadata and controls
74 lines (72 loc) · 2.49 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
import { defineConfig, defineDocs } from "fumadocs-mdx/config";
import { metaSchema, pageSchema } from "fumapress/adapters/mdx/schema";
import { remarkMdxMermaid } from "fumadocs-core/mdx-plugins/remark-mdx-mermaid";
import { remarkAdmonition } from "fumadocs-core/mdx-plugins/remark-admonition";
import { remarkSteps } from "fumadocs-core/mdx-plugins/remark-steps";
import { rehypeCodeDefaultOptions } from "fumadocs-core/mdx-plugins/rehype-code";
import {
transformerMetaHighlight,
transformerNotationHighlight,
} from "@shikijs/transformers";
import remarkMath from "remark-math";
import rehypeKatex from "rehype-katex";
export const docs = defineDocs({
dir: "content",
docs: {
async: true,
schema: pageSchema,
postprocess: {
includeProcessedMarkdown: true,
},
},
meta: {
schema: metaSchema,
},
});
// Global MDX options. Using the function form of `remarkPlugins` / `rehypePlugins`
// appends to Fumadocs' default plugin set (which handles headings, images, links,
// code, etc.) instead of replacing it.
export default defineConfig({
mdxOptions: {
remarkPlugins: (plugins) => [
...plugins,
// Custom typeMap: list `warning` before `warn` so `:::warning[Title]`
// isn't greedily matched by the shorter `warn` key (which would drop the
// title). Values must be valid Callout types: info | warn | error.
remarkSteps,
[
remarkAdmonition,
{
typeMap: {
info: "info",
note: "info",
tip: "info",
important: "info",
success: "info",
warning: "warn",
warn: "warn",
caution: "warn",
danger: "error",
error: "error",
},
},
],
remarkMath,
remarkMdxMermaid,
],
// rehype-katex must run BEFORE Fumadocs' rehype-code (Shiki): remark-math
// emits `<code class="language-math">` nodes, and Shiki would otherwise try
// to highlight a non-existent "math" language. Prepending fixes the order.
rehypePlugins: (plugins) => [rehypeKatex, ...plugins],
// Enable code line-highlighting: `{1,3}` meta ranges and `[!code highlight]`
// notation. Preserve Fumadocs' default transformers (icons, tabs, etc.).
rehypeCodeOptions: {
...rehypeCodeDefaultOptions,
transformers: [
...(rehypeCodeDefaultOptions.transformers ?? []),
transformerMetaHighlight(),
transformerNotationHighlight({ matchAlgorithm: "v3" }),
],
},
},
});