@vercel/geistdocs 2.15.3 → 2.15.4-canary.2a54b38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +1 -1
- package/dist/internal/mdx-to-markdown.d.ts.map +1 -1
- package/dist/internal/mdx-to-markdown.js +9 -0
- package/dist/internal/page-actions-client.js +1 -1
- package/dist/internal/page-actions.d.ts +4 -4
- package/dist/internal/page-actions.d.ts.map +1 -1
- package/dist/internal/page-actions.js +6 -1
- package/dist/internal/source-loader.d.ts +28 -0
- package/dist/internal/source-loader.d.ts.map +1 -0
- package/dist/internal/source-loader.js +77 -0
- package/dist/mdx-basic.d.ts +27 -0
- package/dist/mdx-basic.d.ts.map +1 -0
- package/dist/mdx-basic.js +61 -0
- package/dist/mdx.d.ts +3 -25
- package/dist/mdx.d.ts.map +1 -1
- package/dist/mdx.js +8 -61
- package/dist/mobile-docs-bar.js +1 -1
- package/dist/navigation.d.ts +11 -0
- package/dist/navigation.d.ts.map +1 -0
- package/dist/navigation.js +8 -0
- package/dist/next.d.ts +11 -1
- package/dist/next.d.ts.map +1 -1
- package/dist/next.js +82 -2
- package/dist/pages/docs-custom.d.ts +111 -0
- package/dist/pages/docs-custom.d.ts.map +1 -0
- package/dist/pages/docs-custom.js +250 -0
- package/dist/pages/docs.d.ts +5 -98
- package/dist/pages/docs.d.ts.map +1 -1
- package/dist/pages/docs.js +13 -250
- package/dist/source-config.d.ts +10 -1
- package/dist/source-config.d.ts.map +1 -1
- package/dist/source-config.js +21 -10
- package/dist/source.d.ts +6 -17
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +2 -75
- package/docs/agents.md +1 -1
- package/docs/llms.txt +27 -1
- package/docs/manifest.json +1 -1
- package/docs/pages/configuration.md +26 -0
- package/native-mdx/LICENSE-mdxjs-rs +22 -0
- package/native-mdx/UPSTREAM.md +16 -0
- package/native-mdx/binaries/darwin-arm64.node +0 -0
- package/native-mdx/binaries/linux-x64-gnu.node +0 -0
- package/native-mdx/data-entry.d.mts +15 -0
- package/native-mdx/data-entry.mjs +97 -0
- package/native-mdx/data-projection.mjs +205 -0
- package/native-mdx/fumadocs-adapter.mjs +36 -0
- package/native-mdx/index-emitter.mjs +34 -0
- package/native-mdx/loader-data.cjs +36 -0
- package/native-mdx/loader-mdx.cjs +9 -0
- package/native-mdx/loader-mdx.mjs +419 -0
- package/native-mdx/native-binding.cjs +27 -0
- package/native-mdx/navigation-entry.d.mts +11 -0
- package/native-mdx/navigation-entry.mjs +136 -0
- package/native-mdx/navigation-title.mjs +53 -0
- package/package.json +43 -15
- package/rehype-code-highlights.d.ts +13 -0
- package/rehype-code-highlights.js +230 -0
- package/shared-theme.css +7 -1
- package/source-config.js +27 -10
- package/template/content/docs/configuration.mdx +26 -0
- package/template/package.json +7 -4
- package/template/pnpm-workspace.yaml +3 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/geistdocs",
|
|
3
3
|
"description": "Runtime and CLI for Geistdocs projects.",
|
|
4
|
-
"version": "2.15.
|
|
4
|
+
"version": "2.15.4-canary.2a54b38",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -27,6 +27,8 @@
|
|
|
27
27
|
"cli.js",
|
|
28
28
|
"dist",
|
|
29
29
|
"docs",
|
|
30
|
+
"rehype-code-highlights.d.ts",
|
|
31
|
+
"rehype-code-highlights.js",
|
|
30
32
|
"rehype-task-list-labels.d.ts",
|
|
31
33
|
"rehype-task-list-labels.js",
|
|
32
34
|
"remark-details.d.ts",
|
|
@@ -37,7 +39,8 @@
|
|
|
37
39
|
"shared-theme.css",
|
|
38
40
|
"styles.css",
|
|
39
41
|
"theme.css",
|
|
40
|
-
"LICENSE"
|
|
42
|
+
"LICENSE",
|
|
43
|
+
"native-mdx"
|
|
41
44
|
],
|
|
42
45
|
"exports": {
|
|
43
46
|
"./changelog": {
|
|
@@ -92,6 +95,10 @@
|
|
|
92
95
|
"types": "./dist/source.d.ts",
|
|
93
96
|
"default": "./dist/source.js"
|
|
94
97
|
},
|
|
98
|
+
"./navigation": {
|
|
99
|
+
"types": "./dist/navigation.d.ts",
|
|
100
|
+
"default": "./dist/navigation.js"
|
|
101
|
+
},
|
|
95
102
|
"./sidebar": {
|
|
96
103
|
"types": "./dist/sidebar.d.ts",
|
|
97
104
|
"default": "./dist/sidebar.js"
|
|
@@ -299,14 +306,38 @@
|
|
|
299
306
|
},
|
|
300
307
|
"./styles.css": "./styles.css",
|
|
301
308
|
"./theme.css": "./theme.css",
|
|
302
|
-
"./package.json": "./package.json"
|
|
309
|
+
"./package.json": "./package.json",
|
|
310
|
+
"./pages/docs/custom": {
|
|
311
|
+
"types": "./dist/pages/docs-custom.d.ts",
|
|
312
|
+
"default": "./dist/pages/docs-custom.js"
|
|
313
|
+
},
|
|
314
|
+
"./mdx/basic": {
|
|
315
|
+
"types": "./dist/mdx-basic.d.ts",
|
|
316
|
+
"default": "./dist/mdx-basic.js"
|
|
317
|
+
},
|
|
318
|
+
"./native-mdx": "./native-mdx/loader-mdx.cjs",
|
|
319
|
+
"./native-mdx/data-loader": "./native-mdx/loader-data.cjs",
|
|
320
|
+
"./native-mdx/data-entry": {
|
|
321
|
+
"types": "./native-mdx/data-entry.d.mts",
|
|
322
|
+
"import": "./native-mdx/data-entry.mjs"
|
|
323
|
+
},
|
|
324
|
+
"./native-mdx/navigation-entry": {
|
|
325
|
+
"types": "./native-mdx/navigation-entry.d.mts",
|
|
326
|
+
"import": "./native-mdx/navigation-entry.mjs"
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
"scripts": {
|
|
330
|
+
"build": "node ../../scripts/prepare-native-loader.mjs --runtime-only && rm -rf dist docs template && node ./scripts/bundle-template.mjs && node ./scripts/bundle-docs.mjs && tsc -p tsconfig.runtime.json && tsup --config tsup.config.cli.ts",
|
|
331
|
+
"dev": "tsc -p tsconfig.runtime.json --watch --preserveWatchOutput"
|
|
303
332
|
},
|
|
304
333
|
"dependencies": {
|
|
305
334
|
"@ai-sdk/react": "^3.0.134",
|
|
306
335
|
"@clack/prompts": "^0.11.0",
|
|
307
|
-
"@modelcontextprotocol/server": "^2.
|
|
308
|
-
"@next/env": "16.
|
|
336
|
+
"@modelcontextprotocol/server": "^2.3.0",
|
|
337
|
+
"@next/env": "16.4.5",
|
|
309
338
|
"@orama/tokenizers": "^3.1.16",
|
|
339
|
+
"@pierre/highlights": "0.5.1",
|
|
340
|
+
"@shikijs/rehype": "3.19.0",
|
|
310
341
|
"@streamdown/cjk": "^1.0.1",
|
|
311
342
|
"@types/mdx": "^2.0.13",
|
|
312
343
|
"@types/react": "^19.2.7",
|
|
@@ -322,9 +353,9 @@
|
|
|
322
353
|
"fumadocs-mdx": "14.0.4",
|
|
323
354
|
"fumadocs-ui": "16.2.2",
|
|
324
355
|
"geist": "1.7.1",
|
|
325
|
-
"glob": "^
|
|
356
|
+
"glob": "^14.0.2",
|
|
326
357
|
"mcp-handler": "2.2.0",
|
|
327
|
-
"mermaid": "^11.
|
|
358
|
+
"mermaid": "^11.16.1",
|
|
328
359
|
"next-themes": "^0.4.6",
|
|
329
360
|
"phase": "^0.5.4",
|
|
330
361
|
"radix-ui": "1.6.4",
|
|
@@ -335,6 +366,7 @@
|
|
|
335
366
|
"remark-mdx": "^3.1.1",
|
|
336
367
|
"remark-parse": "^11.0.0",
|
|
337
368
|
"remark-stringify": "^11.0.0",
|
|
369
|
+
"shiki": "3.19.0",
|
|
338
370
|
"sonner": "^2.0.8",
|
|
339
371
|
"streamdown": "^2.1.0",
|
|
340
372
|
"tailwind-merge": "^3.4.0",
|
|
@@ -344,10 +376,10 @@
|
|
|
344
376
|
"unist-util-visit": "^5.1.0",
|
|
345
377
|
"use-stick-to-bottom": "^1.1.1",
|
|
346
378
|
"vaul": "^1.1.2",
|
|
347
|
-
"zod": "^4.6.
|
|
379
|
+
"zod": "^4.6.6"
|
|
348
380
|
},
|
|
349
381
|
"peerDependencies": {
|
|
350
|
-
"next": "^16.
|
|
382
|
+
"next": "^16.4.5",
|
|
351
383
|
"react": "^19.2.3",
|
|
352
384
|
"react-dom": "^19.2.3",
|
|
353
385
|
"tailwindcss": "^4.1.17"
|
|
@@ -359,14 +391,10 @@
|
|
|
359
391
|
"@types/node": "^24.10.1",
|
|
360
392
|
"@types/react-dom": "^19.2.3",
|
|
361
393
|
"mdast-util-mdx-jsx": "^3.2.0",
|
|
362
|
-
"next": "16.
|
|
394
|
+
"next": "16.4.5",
|
|
363
395
|
"react": "^19.2.3",
|
|
364
396
|
"react-dom": "^19.2.3",
|
|
365
397
|
"tsup": "^8.5.1",
|
|
366
398
|
"typescript": "^5.9.3"
|
|
367
|
-
},
|
|
368
|
-
"scripts": {
|
|
369
|
-
"build": "rm -rf dist docs template && node ./scripts/bundle-template.mjs && node ./scripts/bundle-docs.mjs && tsc -p tsconfig.runtime.json && tsup --config tsup.config.cli.ts",
|
|
370
|
-
"dev": "tsc -p tsconfig.runtime.json --watch --preserveWatchOutput"
|
|
371
399
|
}
|
|
372
|
-
}
|
|
400
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { RehypeCodeOptions } from "fumadocs-core/mdx-plugins";
|
|
2
|
+
import type { Root } from "hast";
|
|
3
|
+
|
|
4
|
+
/** Zed-format Geist theme for @pierre/highlights, using Geist's Shiki CSS variables. */
|
|
5
|
+
export declare const geistHighlightsTheme: Record<string, unknown>;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Experimental drop-in for Fumadocs' `rehypeCode` that tokenizes with
|
|
9
|
+
* @pierre/highlights while keeping Shiki's HAST output and transformers.
|
|
10
|
+
*/
|
|
11
|
+
export declare const rehypeCodeHighlights: (
|
|
12
|
+
options?: Partial<RehypeCodeOptions>
|
|
13
|
+
) => (tree: Root, file: unknown) => Promise<void>;
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { codeToTokens, isSupportedLanguage } from "@pierre/highlights";
|
|
2
|
+
import rehypeShikiFromHighlighter from "@shikijs/rehype/core";
|
|
3
|
+
import {
|
|
4
|
+
rehypeCodeDefaultOptions,
|
|
5
|
+
transformerIcon,
|
|
6
|
+
transformerTab,
|
|
7
|
+
} from "fumadocs-core/mdx-plugins";
|
|
8
|
+
import { tokensToHast, transformerDecorations } from "shiki/core";
|
|
9
|
+
|
|
10
|
+
// Experimental: highlights code blocks with @pierre/highlights (hand-written
|
|
11
|
+
// Wasm lexers) instead of Shiki's TextMate grammars, while keeping Shiki's
|
|
12
|
+
// HAST output and transformer pipeline so Fumadocs' code block features
|
|
13
|
+
// (titles, icons, tabs, line notation, diffs, focus) keep working.
|
|
14
|
+
|
|
15
|
+
const v = (name) => `token-${name}`;
|
|
16
|
+
|
|
17
|
+
// Maps Highlights' Zed token names onto the same CSS variables the Geist
|
|
18
|
+
// Shiki theme uses (see `geistShikiTheme`), so the existing palette applies.
|
|
19
|
+
// With a `cssVariables` palette, colors are variable suffixes: `token-keyword`
|
|
20
|
+
// renders as `var(--shiki-token-keyword)`.
|
|
21
|
+
export const geistHighlightsTheme = {
|
|
22
|
+
name: "geist",
|
|
23
|
+
appearance: "light",
|
|
24
|
+
cssVariables: {
|
|
25
|
+
prefix: "--shiki-",
|
|
26
|
+
defaults: { "color-text": "inherit", "color-background": "transparent" },
|
|
27
|
+
},
|
|
28
|
+
style: {
|
|
29
|
+
"editor.foreground": "color-text",
|
|
30
|
+
"editor.background": "color-background",
|
|
31
|
+
syntax: {
|
|
32
|
+
comment: v("comment"),
|
|
33
|
+
"comment.doc": v("comment"),
|
|
34
|
+
"keyword.jsdoc": v("comment"),
|
|
35
|
+
"type.jsdoc": v("comment"),
|
|
36
|
+
"variable.jsdoc": v("comment"),
|
|
37
|
+
constant: v("constant"),
|
|
38
|
+
"constant.builtin": v("constant"),
|
|
39
|
+
boolean: v("constant"),
|
|
40
|
+
number: v("constant"),
|
|
41
|
+
enum: v("constant"),
|
|
42
|
+
"variable.special": v("constant"),
|
|
43
|
+
function: v("function"),
|
|
44
|
+
"function.definition": v("function"),
|
|
45
|
+
"function.method": v("function"),
|
|
46
|
+
constructor: v("function"),
|
|
47
|
+
type: v("function"),
|
|
48
|
+
"type.class": v("function"),
|
|
49
|
+
tag: v("function"),
|
|
50
|
+
"tag.jsx": v("function"),
|
|
51
|
+
"tag.component.jsx": v("function"),
|
|
52
|
+
"tag.doctype": v("function"),
|
|
53
|
+
title: v("function"),
|
|
54
|
+
namespace: v("function"),
|
|
55
|
+
selector: v("function"),
|
|
56
|
+
"selector.class": v("function"),
|
|
57
|
+
"selector.id": v("function"),
|
|
58
|
+
"selector.pseudo": v("function"),
|
|
59
|
+
attribute: v("constant"),
|
|
60
|
+
"attribute.jsx": v("constant"),
|
|
61
|
+
"variable.parameter": v("parameter"),
|
|
62
|
+
property: v("parameter"),
|
|
63
|
+
"property.json_key": v("parameter"),
|
|
64
|
+
label: v("parameter"),
|
|
65
|
+
"text.jsx": v("parameter"),
|
|
66
|
+
"punctuation.list_marker": v("parameter"),
|
|
67
|
+
keyword: v("keyword"),
|
|
68
|
+
"keyword.control": v("keyword"),
|
|
69
|
+
"keyword.declaration": v("keyword"),
|
|
70
|
+
"keyword.import": v("keyword"),
|
|
71
|
+
"keyword.operator": v("keyword"),
|
|
72
|
+
operator: v("keyword"),
|
|
73
|
+
preproc: v("keyword"),
|
|
74
|
+
string: v("string"),
|
|
75
|
+
"string.escape": v("string"),
|
|
76
|
+
"string.special": v("string"),
|
|
77
|
+
"string.special.symbol": v("string"),
|
|
78
|
+
"text.literal": v("string"),
|
|
79
|
+
"string.regex": v("string-expression"),
|
|
80
|
+
punctuation: v("punctuation"),
|
|
81
|
+
"punctuation.bracket": v("punctuation"),
|
|
82
|
+
"punctuation.delimiter": v("punctuation"),
|
|
83
|
+
"punctuation.special": v("keyword"),
|
|
84
|
+
"punctuation.markup": v("punctuation"),
|
|
85
|
+
"punctuation.bracket.html": v("parameter"),
|
|
86
|
+
"punctuation.bracket.jsx": v("parameter"),
|
|
87
|
+
"punctuation.delimiter.html": v("parameter"),
|
|
88
|
+
"punctuation.delimiter.jsx": v("parameter"),
|
|
89
|
+
link_uri: v("link"),
|
|
90
|
+
link_text: v("parameter"),
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// Fenced-code names that Highlights doesn't know but Shiki users write.
|
|
96
|
+
const LANG_ALIASES = {
|
|
97
|
+
plaintext: "plain",
|
|
98
|
+
txt: "plain",
|
|
99
|
+
"": "plain",
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const resolveLang = (lang) => {
|
|
103
|
+
const name = LANG_ALIASES[lang] ?? lang ?? "plain";
|
|
104
|
+
return isSupportedLanguage(name) ? name : "plain";
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const TRAILING_NEWLINE = /\n$/;
|
|
108
|
+
|
|
109
|
+
const ENFORCE_ORDER = { pre: 0, undefined: 1, post: 2 };
|
|
110
|
+
|
|
111
|
+
const getTransformers = (options) => [
|
|
112
|
+
...[...(options.transformers ?? [])].sort(
|
|
113
|
+
(a, b) => ENFORCE_ORDER[a.enforce] - ENFORCE_ORDER[b.enforce]
|
|
114
|
+
),
|
|
115
|
+
transformerDecorations(),
|
|
116
|
+
];
|
|
117
|
+
|
|
118
|
+
const UNSTYLED = "var(--shiki-foreground)";
|
|
119
|
+
|
|
120
|
+
const tokenize = (code, options) => {
|
|
121
|
+
const result = codeToTokens(code, {
|
|
122
|
+
lang: resolveLang(options.lang),
|
|
123
|
+
themes: { light: geistHighlightsTheme },
|
|
124
|
+
defaultColor: "light",
|
|
125
|
+
cssVariablePrefix: "--shiki-",
|
|
126
|
+
});
|
|
127
|
+
// Highlights colors unstyled runs with `var(--shiki-foreground)`; Shiki uses
|
|
128
|
+
// the theme foreground, which Geist defines as `--shiki-color-text`.
|
|
129
|
+
for (const line of result.tokens) {
|
|
130
|
+
for (const token of line) {
|
|
131
|
+
if (token.htmlStyle?.color === UNSTYLED) {
|
|
132
|
+
token.htmlStyle = { ...token.htmlStyle, color: result.fg };
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
tokens: result.tokens,
|
|
138
|
+
fg: result.fg,
|
|
139
|
+
bg: result.bg,
|
|
140
|
+
themeName: "shiki-themes geist",
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* A minimal Shiki highlighter: enough of the API for `@shikijs/rehype/core`.
|
|
146
|
+
* Mirrors Shiki's `codeToHast` (preprocess → tokens → token transformers →
|
|
147
|
+
* `tokensToHast`), swapping the tokenizer for Highlights.
|
|
148
|
+
*/
|
|
149
|
+
export const highlightsShikiAdapter = {
|
|
150
|
+
getLoadedLanguages: () => [],
|
|
151
|
+
loadLanguage: async () => undefined,
|
|
152
|
+
codeToTokens: (code, options) => tokenize(code, options),
|
|
153
|
+
codeToHast(code, options) {
|
|
154
|
+
const transformers = getTransformers(options);
|
|
155
|
+
const context = {
|
|
156
|
+
meta: {},
|
|
157
|
+
options,
|
|
158
|
+
codeToHast: (c, o) => highlightsShikiAdapter.codeToHast(c, o),
|
|
159
|
+
codeToTokens: (c, o) => tokenize(c, o),
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
let input = code;
|
|
163
|
+
for (const transformer of transformers) {
|
|
164
|
+
input = transformer.preprocess?.call(context, input, options) || input;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
let { tokens, fg, bg, themeName } = tokenize(input, options);
|
|
168
|
+
const contextSource = {
|
|
169
|
+
...context,
|
|
170
|
+
get source() {
|
|
171
|
+
return input;
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
for (const transformer of transformers) {
|
|
175
|
+
tokens = transformer.tokens?.call(contextSource, tokens) || tokens;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return tokensToHast(
|
|
179
|
+
tokens,
|
|
180
|
+
{
|
|
181
|
+
...options,
|
|
182
|
+
fg,
|
|
183
|
+
bg,
|
|
184
|
+
themeName,
|
|
185
|
+
transformers: options.transformers,
|
|
186
|
+
},
|
|
187
|
+
contextSource
|
|
188
|
+
);
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
/** Drop-in for Fumadocs' `rehypeCode`, backed by @pierre/highlights. */
|
|
193
|
+
export const rehypeCodeHighlights = (userOptions = {}) => {
|
|
194
|
+
const options = { ...rehypeCodeDefaultOptions, ...userOptions };
|
|
195
|
+
const transformers = [...(options.transformers ?? [])];
|
|
196
|
+
|
|
197
|
+
// Same preprocessing as Fumadocs' rehypeCode.
|
|
198
|
+
transformers.unshift({
|
|
199
|
+
name: "rehype-code:pre-process",
|
|
200
|
+
preprocess(code, { meta }) {
|
|
201
|
+
if (meta && "__parsed_raw" in meta) {
|
|
202
|
+
meta.__raw = meta.__parsed_raw;
|
|
203
|
+
// biome-ignore lint/performance/noDelete: matches Fumadocs.
|
|
204
|
+
delete meta.__parsed_raw;
|
|
205
|
+
}
|
|
206
|
+
if (meta && options.filterMetaString) {
|
|
207
|
+
meta.__raw = options.filterMetaString(meta.__raw ?? "");
|
|
208
|
+
}
|
|
209
|
+
return code.replace(TRAILING_NEWLINE, "");
|
|
210
|
+
},
|
|
211
|
+
});
|
|
212
|
+
if (options.icon !== false) {
|
|
213
|
+
transformers.push(transformerIcon(options.icon));
|
|
214
|
+
}
|
|
215
|
+
if (options.tab !== false) {
|
|
216
|
+
transformers.push(transformerTab());
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// `lazy` routes every language through `loadLanguage`, which is a no-op:
|
|
220
|
+
// Highlights bundles its lexers and unknown languages fall back to plain.
|
|
221
|
+
const transformer = rehypeShikiFromHighlighter(highlightsShikiAdapter, {
|
|
222
|
+
...options,
|
|
223
|
+
lazy: true,
|
|
224
|
+
transformers,
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
return async (tree, file) => {
|
|
228
|
+
await transformer(tree, file, () => undefined);
|
|
229
|
+
};
|
|
230
|
+
};
|
package/shared-theme.css
CHANGED
|
@@ -281,7 +281,13 @@ button:not(:disabled, [aria-disabled="true"]) {
|
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
-
@container (
|
|
284
|
+
@container (width < 961px) {
|
|
285
|
+
#nd-page {
|
|
286
|
+
max-width: none;
|
|
287
|
+
padding-inline: 1.5rem;
|
|
288
|
+
transform: none;
|
|
289
|
+
}
|
|
290
|
+
|
|
285
291
|
#nd-page > .text-gray-900:first-child {
|
|
286
292
|
display: none;
|
|
287
293
|
}
|
package/source-config.js
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
} from "fumadocs-mdx/config";
|
|
16
16
|
import lastModified from "fumadocs-mdx/plugins/last-modified";
|
|
17
17
|
import { z } from "zod";
|
|
18
|
+
import { rehypeCodeHighlights } from "./rehype-code-highlights.js";
|
|
18
19
|
import { rehypeTaskListLabels } from "./rehype-task-list-labels.js";
|
|
19
20
|
import { remarkDetails } from "./remark-details.js";
|
|
20
21
|
|
|
@@ -276,11 +277,18 @@ export const resolveGeistdocsRemarkPlugins = (
|
|
|
276
277
|
// Mirrors src/source-config.ts. Geistdocs rehype plugins run after the
|
|
277
278
|
// consumer's: an array is handed to Fumadocs, which places it among its
|
|
278
279
|
// defaults; a function receives those defaults and returns the final list.
|
|
279
|
-
export const resolveGeistdocsRehypePlugins = (
|
|
280
|
+
export const resolveGeistdocsRehypePlugins = (
|
|
281
|
+
consumerPlugins,
|
|
282
|
+
leadingPlugins = []
|
|
283
|
+
) => {
|
|
280
284
|
if (typeof consumerPlugins === "function") {
|
|
281
|
-
return (defaults) => [
|
|
285
|
+
return (defaults) => [
|
|
286
|
+
...leadingPlugins,
|
|
287
|
+
...consumerPlugins(defaults),
|
|
288
|
+
rehypeTaskListLabels,
|
|
289
|
+
];
|
|
282
290
|
}
|
|
283
|
-
return [...(consumerPlugins ?? []), rehypeTaskListLabels];
|
|
291
|
+
return [...leadingPlugins, ...(consumerPlugins ?? []), rehypeTaskListLabels];
|
|
284
292
|
};
|
|
285
293
|
|
|
286
294
|
export const defineGeistdocsSourceConfig = (config = {}) => {
|
|
@@ -288,21 +296,30 @@ export const defineGeistdocsSourceConfig = (config = {}) => {
|
|
|
288
296
|
? config.mdxOptions.remarkPlugins
|
|
289
297
|
: [];
|
|
290
298
|
const existingPlugins = Array.isArray(config.plugins) ? config.plugins : [];
|
|
299
|
+
const { highlighter = "highlights", ...fumadocsConfig } = config;
|
|
300
|
+
const rehypeCodeOptions = {
|
|
301
|
+
...config.mdxOptions?.rehypeCodeOptions,
|
|
302
|
+
themes: { light: geistShikiTheme },
|
|
303
|
+
defaultColor: "light",
|
|
304
|
+
};
|
|
305
|
+
// `highlights` swaps Shiki's tokenizer for @pierre/highlights; `shiki`
|
|
306
|
+
// keeps Fumadocs' rehypeCode.
|
|
307
|
+
const highlightingDisabled =
|
|
308
|
+
highlighter === false || config.mdxOptions?.rehypeCodeOptions === false;
|
|
309
|
+
const useHighlights = highlighter === "highlights" && !highlightingDisabled;
|
|
291
310
|
|
|
292
311
|
return defineFumadocsConfig({
|
|
293
|
-
...
|
|
312
|
+
...fumadocsConfig,
|
|
294
313
|
mdxOptions: {
|
|
295
314
|
...config.mdxOptions,
|
|
296
315
|
remarkPlugins: (defaults) =>
|
|
297
316
|
resolveGeistdocsRemarkPlugins(defaults, existingRemarkPlugins),
|
|
298
317
|
rehypePlugins: resolveGeistdocsRehypePlugins(
|
|
299
|
-
config.mdxOptions?.rehypePlugins
|
|
318
|
+
config.mdxOptions?.rehypePlugins,
|
|
319
|
+
useHighlights ? [[rehypeCodeHighlights, rehypeCodeOptions]] : []
|
|
300
320
|
),
|
|
301
|
-
rehypeCodeOptions:
|
|
302
|
-
|
|
303
|
-
themes: { light: geistShikiTheme },
|
|
304
|
-
defaultColor: "light",
|
|
305
|
-
},
|
|
321
|
+
rehypeCodeOptions:
|
|
322
|
+
useHighlights || highlightingDisabled ? false : rehypeCodeOptions,
|
|
306
323
|
},
|
|
307
324
|
plugins: [
|
|
308
325
|
lastModified({ versionControl: getLastModified }),
|
|
@@ -283,6 +283,32 @@ export const docs = defineDocs({
|
|
|
283
283
|
export default defineGeistdocsSourceConfig();
|
|
284
284
|
```
|
|
285
285
|
|
|
286
|
+
### MDX compiler
|
|
287
|
+
|
|
288
|
+
`createGeistdocs()` uses the native Rust MDX compiler by default with both Turbopack and webpack. Compatible pages compile natively; custom plugins, Shiki, unsupported content and platforms without a native binary use the JS pipeline automatically. Build output reports fallback reasons.
|
|
289
|
+
|
|
290
|
+
Select a compiler in `next.config.ts`:
|
|
291
|
+
|
|
292
|
+
```ts
|
|
293
|
+
const withGeistdocs = createGeistdocs({ mdxCompiler: "auto" });
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
- `"auto"` (default): native when compatible, JS otherwise.
|
|
297
|
+
- `"native"`: fail if a page needs JS fallback; useful for checking native coverage.
|
|
298
|
+
- `"js"`: use the existing JS compiler for every page.
|
|
299
|
+
|
|
300
|
+
Frontmatter-only requests do not compile page bodies. Native binaries ship with Geistdocs for macOS arm64 and Linux x64 (glibc 2.31+); consumers do not install Rust or a separate compiler package. Unsupported native content currently includes npm fences, Markdown images, includes, explicit code-tab wrappers and math. Actual native compiler errors fail the build instead of silently switching compilers.
|
|
301
|
+
|
|
302
|
+
### Code highlighter
|
|
303
|
+
|
|
304
|
+
For a custom highlighter, pass `highlighter: false` to `defineGeistdocsSourceConfig`; the native compiler will fall back to JS so your plugins run. Passing `mdxOptions.rehypeCodeOptions: false` to the helper also disables built-in highlighting.
|
|
305
|
+
|
|
306
|
+
Code blocks are tokenized by [Highlights](https://diffs.com/highlights), which uses hand-written WebAssembly lexers, and rendered with the same HTML as Shiki: Geist colors, titles, icons, tabs, and `[!code ...]` notation all work. Languages without a built-in Highlights lexer render as plain text. To use Shiki's TextMate grammars instead, for example for an unsupported language, pass `highlighter: "shiki"`:
|
|
307
|
+
|
|
308
|
+
```ts title="source.config.ts"
|
|
309
|
+
export default defineGeistdocsSourceConfig({ highlighter: "shiki" });
|
|
310
|
+
```
|
|
311
|
+
|
|
286
312
|
To serve docs from the site root, use `route: "/"` in `content` and `baseUrl: "/"` in `createSource`. Root-mounted docs need explicit `markdownRoutes`; Geistdocs does not infer a broad `/*path` mapping because it can capture homepages and non-docs app routes.
|
|
287
313
|
|
|
288
314
|
## Page URLs
|
package/template/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@streamdown/code": "^1.0.1",
|
|
18
18
|
"@vercel/agent-readability": "^0.7.0",
|
|
19
19
|
"@vercel/analytics": "^1.6.1",
|
|
20
|
-
"@vercel/geistdocs": "2.15.
|
|
20
|
+
"@vercel/geistdocs": "2.15.4-canary.2a54b38",
|
|
21
21
|
"@vercel/speed-insights": "^1.3.1",
|
|
22
22
|
"ai": "^6.0.132",
|
|
23
23
|
"clsx": "^2.1.1",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"fumadocs-ui": "16.2.2",
|
|
30
30
|
"geist": "1.7.1",
|
|
31
31
|
"jotai": "^2.15.2",
|
|
32
|
-
"mermaid": "^11.
|
|
32
|
+
"mermaid": "^11.16.1",
|
|
33
33
|
"nanoid": "^5.1.6",
|
|
34
|
-
"next": "16.
|
|
34
|
+
"next": "16.4.5",
|
|
35
35
|
"next-themes": "^0.4.6",
|
|
36
36
|
"react": "^19.2.3",
|
|
37
37
|
"react-dom": "^19.2.3",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"streamdown": "^2.1.0",
|
|
41
41
|
"tailwind-merge": "^3.4.0",
|
|
42
42
|
"use-stick-to-bottom": "^1.1.1",
|
|
43
|
-
"zod": "^4.
|
|
43
|
+
"zod": "^4.6.6"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@tailwindcss/postcss": "^4.1.17",
|
|
@@ -52,5 +52,8 @@
|
|
|
52
52
|
"tailwindcss": "^4.1.17",
|
|
53
53
|
"tw-animate-css": "^1.4.0",
|
|
54
54
|
"typescript": "^5.9.3"
|
|
55
|
+
},
|
|
56
|
+
"overrides": {
|
|
57
|
+
"katex": "0.18.2"
|
|
55
58
|
}
|
|
56
59
|
}
|