@vercel/geistdocs 1.25.1-canary.4e75e60 → 1.25.1-canary.62250e6
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/components/code-block-tabs.js +1 -1
- package/dist/components/code-block.d.ts.map +1 -1
- package/dist/components/code-block.js +1 -1
- package/dist/components/copy-prompt.js +1 -1
- package/dist/components/image.d.ts +19 -0
- package/dist/components/image.d.ts.map +1 -0
- package/dist/components/image.js +9 -0
- package/dist/components/steps.d.ts +9 -0
- package/dist/components/steps.d.ts.map +1 -0
- package/dist/components/steps.js +9 -0
- package/dist/internal/chat/activity.d.ts +20 -0
- package/dist/internal/chat/activity.d.ts.map +1 -0
- package/dist/internal/chat/activity.js +43 -0
- package/dist/internal/chat/message-metadata.d.ts.map +1 -1
- package/dist/internal/chat/message-metadata.js +15 -30
- package/dist/internal/chat/message-sources.d.ts +3 -0
- package/dist/internal/chat/message-sources.d.ts.map +1 -0
- package/dist/internal/chat/message-sources.js +23 -0
- package/dist/internal/chat/message.d.ts.map +1 -1
- package/dist/internal/chat/message.js +44 -10
- package/dist/internal/chat/shell.d.ts.map +1 -1
- package/dist/internal/chat/shell.js +7 -2
- package/dist/internal/chat/source-chunks.d.ts +9 -0
- package/dist/internal/chat/source-chunks.d.ts.map +1 -0
- package/dist/internal/chat/source-chunks.js +7 -0
- package/dist/internal/chat/sources.d.ts +1 -1
- package/dist/internal/chat/sources.d.ts.map +1 -1
- package/dist/internal/chat/sources.js +6 -3
- package/dist/internal/link-href.d.ts +13 -0
- package/dist/internal/link-href.d.ts.map +1 -0
- package/dist/internal/link-href.js +51 -0
- package/dist/internal/mdx-to-markdown.d.ts +3 -0
- package/dist/internal/mdx-to-markdown.d.ts.map +1 -0
- package/dist/internal/mdx-to-markdown.js +166 -0
- package/dist/internal/react-node-text.d.ts +4 -0
- package/dist/internal/react-node-text.d.ts.map +1 -0
- package/dist/internal/react-node-text.js +11 -0
- package/dist/internal/search.js +1 -1
- package/dist/internal/sidebar-tree.d.ts.map +1 -1
- package/dist/internal/sidebar-tree.js +6 -1
- package/dist/internal/toc-items.d.ts.map +1 -1
- package/dist/internal/toc-items.js +2 -1
- package/dist/mdx.d.ts.map +1 -1
- package/dist/mdx.js +5 -0
- package/dist/pages/docs.d.ts.map +1 -1
- package/dist/pages/docs.js +10 -5
- package/dist/routes/chat.d.ts.map +1 -1
- package/dist/routes/chat.js +30 -13
- package/dist/routes/llms.d.ts +1 -1
- package/dist/routes/llms.d.ts.map +1 -1
- package/dist/routes/llms.js +12 -2
- package/dist/source-config.d.ts +10 -0
- package/dist/source-config.d.ts.map +1 -1
- package/dist/source-config.js +20 -2
- package/dist/source.d.ts +10 -1
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +75 -34
- package/dist/versions.js +2 -2
- package/docs/agents.md +5 -3
- package/docs/llms.txt +388 -28
- package/docs/manifest.json +21 -3
- package/docs/pages/components/steps.md +129 -0
- package/docs/pages/deployment.md +30 -5
- package/docs/pages/getting-started.md +38 -12
- package/docs/pages/guides/nested-navigation.md +1 -1
- package/docs/pages/md.md +24 -5
- package/docs/pages/migration-2.md +106 -0
- package/docs/pages/migration.md +5 -2
- package/docs/pages/syntax.md +42 -0
- package/docs/sitemap.md +4 -2
- package/package.json +14 -4
- package/source-config.js +37 -2
- package/template/content/docs/components/meta.json +4 -0
- package/template/content/docs/components/steps.mdx +125 -0
- package/template/content/docs/deployment.mdx +31 -6
- package/template/content/docs/getting-started.mdx +39 -13
- package/template/content/docs/guides/nested-navigation.mdx +1 -1
- package/template/content/docs/md.mdx +24 -5
- package/template/content/docs/meta.json +3 -0
- package/template/content/docs/migration-2.mdx +106 -0
- package/template/content/docs/migration.mdx +5 -1
- package/template/content/docs/syntax.mdx +42 -0
- package/template/next.config.ts +9 -0
- package/template/package.json +3 -3
- package/theme.css +50 -4
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const HTTP_URL = /^https?:\/\//;
|
|
2
|
+
const normalizeBasePath = (basePath) => {
|
|
3
|
+
if (!(basePath && basePath !== "/")) {
|
|
4
|
+
return "";
|
|
5
|
+
}
|
|
6
|
+
return `/${basePath.replace(/^\/+|\/+$/g, "")}`;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Treat an absolute URL on the configured production origin as app-local.
|
|
10
|
+
* Keeping the path, query, and hash makes canonical links navigate internally
|
|
11
|
+
* on production domains and previews alike.
|
|
12
|
+
*/
|
|
13
|
+
export const resolveLinkHref = (href, siteUrl) => {
|
|
14
|
+
if (!HTTP_URL.test(href)) {
|
|
15
|
+
return { external: false, href };
|
|
16
|
+
}
|
|
17
|
+
if (!siteUrl) {
|
|
18
|
+
return { external: true, href };
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const url = new URL(href);
|
|
22
|
+
const site = new URL(siteUrl);
|
|
23
|
+
if (url.origin === site.origin) {
|
|
24
|
+
return {
|
|
25
|
+
external: false,
|
|
26
|
+
href: `${url.pathname}${url.search}${url.hash}`,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
// Preserve the existing external treatment for malformed absolute URLs.
|
|
32
|
+
}
|
|
33
|
+
return { external: true, href };
|
|
34
|
+
};
|
|
35
|
+
/** Strip the Next.js base path before handing an href to `next/link`. */
|
|
36
|
+
export const stripBasePathFromHref = (href, basePath) => {
|
|
37
|
+
const prefix = normalizeBasePath(basePath);
|
|
38
|
+
if (!prefix) {
|
|
39
|
+
return href;
|
|
40
|
+
}
|
|
41
|
+
if (href === prefix) {
|
|
42
|
+
return "/";
|
|
43
|
+
}
|
|
44
|
+
if (href.startsWith(`${prefix}/`)) {
|
|
45
|
+
return href.slice(prefix.length);
|
|
46
|
+
}
|
|
47
|
+
if (href.startsWith(`${prefix}?`) || href.startsWith(`${prefix}#`)) {
|
|
48
|
+
return `/${href.slice(prefix.length)}`;
|
|
49
|
+
}
|
|
50
|
+
return href;
|
|
51
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mdx-to-markdown.d.ts","sourceRoot":"","sources":["../../src/internal/mdx-to-markdown.ts"],"names":[],"mappings":"AAiNA,yEAAyE;AACzE,eAAO,MAAM,aAAa,GAAU,QAAQ,MAAM,oBACF,CAAC"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import remarkFrontmatter from "remark-frontmatter";
|
|
2
|
+
import remarkGfm from "remark-gfm";
|
|
3
|
+
import remarkMdx from "remark-mdx";
|
|
4
|
+
import remarkParse from "remark-parse";
|
|
5
|
+
import remarkStringify from "remark-stringify";
|
|
6
|
+
import { unified } from "unified";
|
|
7
|
+
const getAttribute = (node, name) => {
|
|
8
|
+
const attribute = node.attributes?.find((entry) => entry.type === "mdxJsxAttribute" && entry.name === name);
|
|
9
|
+
if (!attribute) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
if (typeof attribute.value === "string") {
|
|
13
|
+
return attribute.value;
|
|
14
|
+
}
|
|
15
|
+
const expression = attribute.value?.value?.trim();
|
|
16
|
+
if (!expression) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
const parsed = JSON.parse(expression);
|
|
21
|
+
return typeof parsed === "string" ? parsed : undefined;
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const paragraph = (value) => ({
|
|
28
|
+
children: [{ type: "text", value }],
|
|
29
|
+
type: "paragraph",
|
|
30
|
+
});
|
|
31
|
+
const OMITTED_NODE_TYPES = new Set([
|
|
32
|
+
"mdxFlowExpression",
|
|
33
|
+
"mdxTextExpression",
|
|
34
|
+
"mdxjsEsm",
|
|
35
|
+
"yaml",
|
|
36
|
+
]);
|
|
37
|
+
const OMITTED_COMPONENTS = new Set([
|
|
38
|
+
"CodeBlockTabsList",
|
|
39
|
+
"CodeBlockTabsTrigger",
|
|
40
|
+
]);
|
|
41
|
+
const imageNodes = (node) => {
|
|
42
|
+
const nodes = [];
|
|
43
|
+
const alt = getAttribute(node, "alt") ?? "";
|
|
44
|
+
const source = getAttribute(node, "srcLight") ?? getAttribute(node, "src");
|
|
45
|
+
if (source) {
|
|
46
|
+
nodes.push({
|
|
47
|
+
children: [{ alt, type: "image", url: source }],
|
|
48
|
+
type: "paragraph",
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
const caption = getAttribute(node, "caption");
|
|
52
|
+
if (caption) {
|
|
53
|
+
nodes.push(paragraph(caption));
|
|
54
|
+
}
|
|
55
|
+
return nodes;
|
|
56
|
+
};
|
|
57
|
+
const calloutNode = (node) => {
|
|
58
|
+
const title = getAttribute(node, "title");
|
|
59
|
+
const heading = title
|
|
60
|
+
? [
|
|
61
|
+
{
|
|
62
|
+
children: [
|
|
63
|
+
{
|
|
64
|
+
children: [{ type: "text", value: `${title}:` }],
|
|
65
|
+
type: "strong",
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
type: "paragraph",
|
|
69
|
+
},
|
|
70
|
+
]
|
|
71
|
+
: [];
|
|
72
|
+
return {
|
|
73
|
+
children: [...heading, ...(node.children ?? [])],
|
|
74
|
+
type: "blockquote",
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
const replaceComponent = (node) => {
|
|
78
|
+
if (OMITTED_COMPONENTS.has(node.name ?? "")) {
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
81
|
+
if (node.name === "Check" || node.name === "Cross") {
|
|
82
|
+
return [{ type: "text", value: node.name === "Check" ? "✓" : "✗" }];
|
|
83
|
+
}
|
|
84
|
+
if (node.name === "Image") {
|
|
85
|
+
return imageNodes(node);
|
|
86
|
+
}
|
|
87
|
+
if (node.name === "Callout") {
|
|
88
|
+
return [calloutNode(node)];
|
|
89
|
+
}
|
|
90
|
+
const text = getAttribute(node, "text");
|
|
91
|
+
if ((node.name === "CopyPrompt" || node.name === "Prompt") && text) {
|
|
92
|
+
return [paragraph(text)];
|
|
93
|
+
}
|
|
94
|
+
// Presentation-only components (including CodeBlockTabs and CodeBlockTab)
|
|
95
|
+
// should not leak into agent-readable Markdown. Their meaningful children
|
|
96
|
+
// remain in document order, so every tab's fenced code is written out.
|
|
97
|
+
return node.children ?? [];
|
|
98
|
+
};
|
|
99
|
+
const isJsxElement = (node) => node.type === "mdxJsxFlowElement" || node.type === "mdxJsxTextElement";
|
|
100
|
+
// Steps exist in two shapes: the `Steps`/`Step` components authored in MDX and
|
|
101
|
+
// the `div.fd-steps`/`div.fd-step` output that remarkSteps emits for numbered
|
|
102
|
+
// headings. Both flatten to their content with the step number restored on
|
|
103
|
+
// each step heading so the Markdown reads as the author wrote it.
|
|
104
|
+
const isStepsNode = (node) => isJsxElement(node) &&
|
|
105
|
+
(node.name === "Steps" ||
|
|
106
|
+
(node.name === "div" && getAttribute(node, "className") === "fd-steps"));
|
|
107
|
+
const isStepNode = (node) => isJsxElement(node) &&
|
|
108
|
+
(node.name === "Step" ||
|
|
109
|
+
(node.name === "div" && getAttribute(node, "className") === "fd-step"));
|
|
110
|
+
const stepsNodes = (node) => {
|
|
111
|
+
let index = 0;
|
|
112
|
+
return (node.children ?? []).flatMap((child) => {
|
|
113
|
+
if (!isStepNode(child)) {
|
|
114
|
+
return cleanNode(child);
|
|
115
|
+
}
|
|
116
|
+
index += 1;
|
|
117
|
+
const content = (child.children ?? []).flatMap(cleanNode);
|
|
118
|
+
const heading = content.find((entry) => entry.type === "heading");
|
|
119
|
+
if (heading) {
|
|
120
|
+
heading.children = [
|
|
121
|
+
{ type: "text", value: `${index}. ` },
|
|
122
|
+
...(heading.children ?? []),
|
|
123
|
+
];
|
|
124
|
+
}
|
|
125
|
+
return content;
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
const cleanNode = (node) => {
|
|
129
|
+
if (OMITTED_NODE_TYPES.has(node.type)) {
|
|
130
|
+
return [];
|
|
131
|
+
}
|
|
132
|
+
if (isStepsNode(node)) {
|
|
133
|
+
return stepsNodes(node);
|
|
134
|
+
}
|
|
135
|
+
if (node.children) {
|
|
136
|
+
node.children = node.children.flatMap(cleanNode);
|
|
137
|
+
}
|
|
138
|
+
if (!isJsxElement(node)) {
|
|
139
|
+
return [node];
|
|
140
|
+
}
|
|
141
|
+
// Native HTML can carry meaning Markdown has no equivalent for (`details`,
|
|
142
|
+
// `summary`, media, and so on). Keep it; only component-shaped JSX is a
|
|
143
|
+
// presentation abstraction that needs flattening.
|
|
144
|
+
if (node.name && node.name === node.name.toLowerCase()) {
|
|
145
|
+
return [node];
|
|
146
|
+
}
|
|
147
|
+
return replaceComponent(node);
|
|
148
|
+
};
|
|
149
|
+
const cleanChildren = (parent) => {
|
|
150
|
+
parent.children = (parent.children ?? []).flatMap(cleanNode);
|
|
151
|
+
};
|
|
152
|
+
const cleanMdx = () => (tree) => {
|
|
153
|
+
cleanChildren(tree);
|
|
154
|
+
};
|
|
155
|
+
const processor = unified()
|
|
156
|
+
.use(remarkParse)
|
|
157
|
+
.use(remarkGfm)
|
|
158
|
+
.use(remarkMdx)
|
|
159
|
+
.use(remarkFrontmatter, ["yaml"])
|
|
160
|
+
.use(cleanMdx)
|
|
161
|
+
.use(remarkStringify, {
|
|
162
|
+
bullet: "-",
|
|
163
|
+
fences: true,
|
|
164
|
+
});
|
|
165
|
+
/** Convert authored MDX into component-free, agent-readable Markdown. */
|
|
166
|
+
export const mdxToMarkdown = async (source) => String(await processor.process(source)).trim();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-node-text.d.ts","sourceRoot":"","sources":["../../src/internal/react-node-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjE,6EAA6E;AAC7E,eAAO,MAAM,eAAe,GAAI,MAAM,SAAS,KAAG,MAUjD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Children, isValidElement } from "react";
|
|
2
|
+
/** Flatten heading presentation markup into the text shown in navigation. */
|
|
3
|
+
export const reactNodeToText = (node) => {
|
|
4
|
+
if (typeof node === "string" || typeof node === "number") {
|
|
5
|
+
return String(node);
|
|
6
|
+
}
|
|
7
|
+
if (isValidElement(node)) {
|
|
8
|
+
return reactNodeToText(node.props.children);
|
|
9
|
+
}
|
|
10
|
+
return Children.toArray(node).map(reactNodeToText).join("");
|
|
11
|
+
};
|
package/dist/internal/search.js
CHANGED
|
@@ -11,5 +11,5 @@ export const GeistdocsSearchDialog = ({ basePath, ...props }) => {
|
|
|
11
11
|
locale,
|
|
12
12
|
api: getPublicPath("/api/search", basePath),
|
|
13
13
|
});
|
|
14
|
-
return (_jsxs(FumadocsSearchDialog, { isLoading: query.isLoading, onSearchChange: setSearch, search: search, ...props, children: [_jsx(SearchDialogOverlay, { className: "bg-background-100/80 backdrop-blur-none" }), _jsxs(SearchDialogContent, { className: "border-none", "data-geistdocs-command-modal": true, onEscapeKeyDown: () => props.onOpenChange(false), children: [_jsxs(SearchDialogHeader, { children: [_jsx(SearchDialogIcon, {}), _jsx(SearchDialogInput, {}), _jsx(SearchDialogClose, {})] }), _jsx(SearchDialogList, { "aria-label": "Search results", Item: (itemProps) => (_jsx(SearchDialogListItem, { ...itemProps, role: "option" })), items: query.data === "empty" ? null : query.data, role: "listbox" })] })] }));
|
|
14
|
+
return (_jsxs(FumadocsSearchDialog, { isLoading: query.isLoading, onSearchChange: setSearch, search: search, ...props, children: [_jsx(SearchDialogOverlay, { className: "bg-background-100/80 backdrop-blur-none" }), _jsxs(SearchDialogContent, { className: "w-[640px] max-w-[calc(100vw-1rem)] border-none shadow-[var(--ds-shadow-modal)]", "data-geistdocs-command-modal": true, onEscapeKeyDown: () => props.onOpenChange(false), children: [_jsxs(SearchDialogHeader, { children: [_jsx(SearchDialogIcon, {}), _jsx(SearchDialogInput, {}), _jsx(SearchDialogClose, {})] }), _jsx(SearchDialogList, { "aria-label": "Search results", Item: (itemProps) => (_jsx(SearchDialogListItem, { ...itemProps, role: "option" })), items: query.data === "empty" ? null : query.data, role: "listbox" })] })] }));
|
|
15
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar-tree.d.ts","sourceRoot":"","sources":["../../src/internal/sidebar-tree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAA;CAAE,CAAC,CAAC;AAE5E,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAC5B,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,eAAO,MAAM,mBAAmB,GAC9B,MAAM,IAAI,GAAG,SAAS,KACrB,MAAM,GAAG,SAGX,CAAC;
|
|
1
|
+
{"version":3,"file":"sidebar-tree.d.ts","sourceRoot":"","sources":["../../src/internal/sidebar-tree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAA;CAAE,CAAC,CAAC;AAE5E,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAC5B,KAAK,CAAC,EAAE,SAAS,CAAC;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
const STATUS_BADGE_TONES = {
|
|
18
|
+
New: "bg-blue-200 text-blue-900",
|
|
19
|
+
};
|
|
20
|
+
export const getSidebarBadgeTone = (label) => STATUS_BADGE_TONES[label] ??
|
|
21
|
+
METHOD_BADGE_TONES[label] ??
|
|
22
|
+
"bg-gray-alpha-400 text-gray-1000";
|
|
18
23
|
export const isExternalSidebarItem = (item) => Boolean(item && (item.external || EXTERNAL_URL.test(item.url)));
|
|
19
24
|
export const isExternalSidebarUrl = (url) => EXTERNAL_URL.test(url);
|
|
20
25
|
export const hasSeparateRootDisclosure = (node) => node.type === "folder" &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toc-items.d.ts","sourceRoot":"","sources":["../../src/internal/toc-items.tsx"],"names":[],"mappings":"AASA,OAAO,EACL,KAAK,cAAc,EAKpB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"toc-items.d.ts","sourceRoot":"","sources":["../../src/internal/toc-items.tsx"],"names":[],"mappings":"AASA,OAAO,EACL,KAAK,cAAc,EAKpB,MAAM,OAAO,CAAC;AAuCf,eAAO,MAAM,QAAQ,GAAI,yBAAyB,cAAc,CAAC,KAAK,CAAC,4CA2FtE,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { cn } from "@vercel/geistcn/utils";
|
|
|
4
4
|
import { TOCItem as TOCItemLink, useActiveAnchors, } from "fumadocs-core/toc";
|
|
5
5
|
import { useTOCItems } from "fumadocs-ui/components/toc/index";
|
|
6
6
|
import { useCallback, useEffect, useRef, useState, } from "react";
|
|
7
|
+
import { reactNodeToText } from "./react-node-text";
|
|
7
8
|
// Text indentation per heading depth; the guide rail stays straight.
|
|
8
9
|
const getItemOffset = (depth) => {
|
|
9
10
|
if (depth <= 2) {
|
|
@@ -17,7 +18,7 @@ const getItemOffset = (depth) => {
|
|
|
17
18
|
// Ignore programmatic scrolling this long after a click/deep-link so the jump
|
|
18
19
|
// to the anchor does not immediately release the selection.
|
|
19
20
|
const ANCHOR_SCROLL_MS = 600;
|
|
20
|
-
const TOCItem = ({ item, active, onSelect, }) => (_jsx(TOCItemLink, { className: "prose wrap-anywhere border-fd-foreground/10 border-s py-1.5 text-gray-900 text-sm transition-colors first:pt-0 last:pb-0 hover:text-fd-accent-foreground data-[active=true]:border-fd-primary data-[active=true]:text-fd-primary", "data-active": active ? "true" : undefined, href: item.url, onClick: onSelect, style: { paddingInlineStart: getItemOffset(item.depth) }, children: item.title }));
|
|
21
|
+
const TOCItem = ({ item, active, onSelect, }) => (_jsx(TOCItemLink, { className: "prose wrap-anywhere border-fd-foreground/10 border-s py-1.5 text-gray-900 text-sm transition-colors first:pt-0 last:pb-0 hover:text-fd-accent-foreground data-[active=true]:border-fd-primary data-[active=true]:text-fd-primary", "data-active": active ? "true" : undefined, href: item.url, onClick: onSelect, style: { paddingInlineStart: getItemOffset(item.depth) }, children: reactNodeToText(item.title) }));
|
|
21
22
|
export const TOCItems = ({ className, ...props }) => {
|
|
22
23
|
const items = useTOCItems();
|
|
23
24
|
const anchors = useActiveAnchors();
|
package/dist/mdx.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdx.d.ts","sourceRoot":"","sources":["../src/mdx.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"mdx.d.ts","sourceRoot":"","sources":["../src/mdx.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAwB/C,OAAO,EAGL,KAAK,4BAA4B,IAAI,mBAAmB,EAGzD,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,2BAA2B,8EAAe,CAAC;AACxD,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAAoB,CAAC;AAC5D,eAAO,MAAM,mBAAmB;;;;;;;gCAAa,CAAC;AAC9C,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;CAAa,CAAC;AAC1C,MAAM,MAAM,4BAA4B,GAAG,mBAAmB,CAAC;AAE/D,MAAM,MAAM,sBAAsB,GAAG,aAAa,CAAC;AAEnD,eAAO,MAAM,yBAAyB,GACpC,aAAa,sBAAsB,KAClC,sBAoDD,CAAC;AAEH,eAAO,MAAM,mBAAmB,GAC9B,aAAa,sBAAsB,KAClC,sBAA+D,CAAC;AAEnE,eAAO,MAAM,2BAA2B,GACtC,GAAG,eAAe,KAAK,CAAC,sBAAsB,GAAG,SAAS,CAAC,KAC1D,sBACkD,CAAC"}
|
package/dist/mdx.js
CHANGED
|
@@ -8,7 +8,9 @@ import { CodeBlock } from "./components/code-block";
|
|
|
8
8
|
import { CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, CompactCodeBlockTabs, } from "./components/code-block-tabs";
|
|
9
9
|
import { CopyPrompt } from "./components/copy-prompt";
|
|
10
10
|
import { Heading } from "./components/heading";
|
|
11
|
+
import { Image } from "./components/image";
|
|
11
12
|
import { Mermaid } from "./components/mermaid";
|
|
13
|
+
import { Step, Steps } from "./components/steps";
|
|
12
14
|
import { Table } from "./components/table";
|
|
13
15
|
import { Video } from "./components/video";
|
|
14
16
|
import { LocalizedLink } from "./internal/localized-link";
|
|
@@ -40,7 +42,10 @@ export const getGeistdocsMDXComponents = (components) => ({
|
|
|
40
42
|
CalloutTitle,
|
|
41
43
|
CalloutDescription,
|
|
42
44
|
CopyPrompt,
|
|
45
|
+
Image,
|
|
43
46
|
Mermaid,
|
|
47
|
+
Steps,
|
|
48
|
+
Step,
|
|
44
49
|
Video,
|
|
45
50
|
...components,
|
|
46
51
|
});
|
package/dist/pages/docs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/pages/docs.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,QAAQ,IAAI,gBAAgB,EAE7B,MAAM,+BA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MAAM,EAAE,OAAO,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;SAAE,CAAC,CAAC;KACpD;;oCAcE;QACD,MAAM,EAAE,OAAO,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;SAAE,CAAC,CAAC;KACpD,KAAG,OAAO,CAAC,QAAQ,CAAC;CAwDtB,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;CAA4B,CAAC"}
|
package/dist/pages/docs.js
CHANGED
|
@@ -7,6 +7,7 @@ import { notFound } from "next/navigation";
|
|
|
7
7
|
import { getPublicPath, withBasePath } from "../config";
|
|
8
8
|
import { DocsPageErrorBoundary } from "../internal/docs-page-error-boundary";
|
|
9
9
|
import { resolveDocumentTitle } from "../internal/document-title";
|
|
10
|
+
import { resolveLinkHref, stripBasePathFromHref } from "../internal/link-href";
|
|
10
11
|
import { resolvePageMarkdownUrl as resolveInternalPageMarkdownUrl } from "../internal/markdown-url.js";
|
|
11
12
|
import { createPageActions as createInternalPageActions } from "../internal/page-actions";
|
|
12
13
|
import { GeistdocsPageActions, GeistdocsTableOfContentsActions, } from "../internal/page-actions-client";
|
|
@@ -15,10 +16,13 @@ import { getPageFooterItems, PageFooter } from "../internal/page-footer";
|
|
|
15
16
|
import { GeistdocsTableOfContents } from "../internal/table-of-contents";
|
|
16
17
|
import { createMdxComponents } from "../mdx";
|
|
17
18
|
import { getPageRobots, } from "../page-visibility";
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
|
|
19
|
+
const renderPrefetchedDocsLink = (siteUrl, basePath, { children, className, href, rel, target, ...props }) => {
|
|
20
|
+
const originalHref = String(href ?? "");
|
|
21
|
+
const resolved = resolveLinkHref(originalHref, siteUrl);
|
|
22
|
+
const linkHref = resolved.href === originalHref
|
|
23
|
+
? resolved.href
|
|
24
|
+
: stripBasePathFromHref(resolved.href, basePath);
|
|
25
|
+
return (_jsx(Link, { ...props, className: cn("font-normal text-gray-1000! underline decoration-1 decoration-gray-700 underline-offset-4 hover:text-gray-1000! hover:decoration-gray-1000 hover:opacity-100!", className), href: linkHref, prefetch: !resolved.external, rel: resolved.external ? rel : undefined, target: resolved.external ? target : undefined, children: children }));
|
|
22
26
|
};
|
|
23
27
|
export const resolvePageMarkdownUrl = (options) => resolveInternalPageMarkdownUrl(options);
|
|
24
28
|
const DocsTitle = ({ className, ...props }) => (_jsx(FumadocsDocsTitle, { className: cn("mb-4 text-balance", className), ...props }));
|
|
@@ -30,6 +34,7 @@ const hasTableOfContentsActions = (config, extraActions) => config.pageActions?.
|
|
|
30
34
|
config.feedback?.enabled !== false ||
|
|
31
35
|
extraActions.length > 0;
|
|
32
36
|
export const createDocsPage = ({ config, source, mdx, pageActions = createInternalPageActions({ config }), filterStaticParams, getMarkdownUrl, getPageUrl, getPublicPageUrl, metadata, openGraph, renderTop, resolveLink, tableOfContent, tableOfContentPopover, }) => {
|
|
37
|
+
const DocsLink = renderPrefetchedDocsLink.bind(null, config.siteUrl, config.basePath);
|
|
33
38
|
const resolvePageUrls = (page, params) => {
|
|
34
39
|
const pageUrl = getPageUrl?.({ page, params }) ?? page.url;
|
|
35
40
|
const publicPageUrl = getPublicPageUrl?.({ page, params, pageUrl }) ??
|
|
@@ -52,7 +57,7 @@ export const createDocsPage = ({ config, source, mdx, pageActions = createIntern
|
|
|
52
57
|
}
|
|
53
58
|
const data = page.data;
|
|
54
59
|
const MDX = data.body;
|
|
55
|
-
const defaultLink = createRelativeLink(source.source, page,
|
|
60
|
+
const defaultLink = createRelativeLink(source.source, page, DocsLink);
|
|
56
61
|
const link = resolveLink
|
|
57
62
|
? resolveLink({ link: defaultLink, page, source })
|
|
58
63
|
: defaultLink;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/routes/chat.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,aAAa,EAQnB,MAAM,IAAI,CAAC;AAGZ,OAAO,EAAE,KAAK,eAAe,EAAiB,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/routes/chat.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,aAAa,EAQnB,MAAM,IAAI,CAAC;AAGZ,OAAO,EAAE,KAAK,eAAe,EAAiB,MAAM,WAAW,CAAC;AAahE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEvD,KAAK,YAAY,GAAG,qBAAqB,CAAC;AAyB1C,UAAU,eAAe;IACvB,OAAO,CAAC,EAAE,WAAW,GAAG,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;IACnE,GAAG,EAAE,MAAM,CAAC;CACb;AAED,UAAU,mBAAmB;IAC3B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,WAAW,GAAG,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;IACnE,qEAAqE;IACrE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,UAAU,sBAAsB;IAC9B,MAAM,EAAE,IAAI,CACV,eAAe,EACf,IAAI,GAAG,UAAU,GAAG,iBAAiB,GAAG,cAAc,CACvD,CAAC;IACF;;;OAGG;IACH,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;CAC1B;AAk0BD,eAAO,MAAM,eAAe,GAAI,sDAO7B,sBAAsB;gBASE,OAAO;;CA+KjC,CAAC"}
|
package/dist/routes/chat.js
CHANGED
|
@@ -3,6 +3,7 @@ import { convertToModelMessages, createUIMessageStream, createUIMessageStreamRes
|
|
|
3
3
|
import { initAdvancedSearch } from "fumadocs-core/search/server";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { getPublicPath } from "../config";
|
|
6
|
+
import { createSourceChunk, createSourceChunks, } from "../internal/chat/source-chunks";
|
|
6
7
|
import { buildEveAgentTranscript, capLastUserMessageText, getEveAgentSessionHandle, resolveEveAgentUrl, runEveAgentTurn, } from "../internal/eve-agent";
|
|
7
8
|
import { isPageVisibleForSurface } from "../page-visibility";
|
|
8
9
|
const DEFAULT_CHAT_MODEL = "openai/gpt-5.6-sol";
|
|
@@ -178,12 +179,6 @@ const getCurrentPageDoc = async ({ basePath, currentRoute, lang, pageContext, so
|
|
|
178
179
|
};
|
|
179
180
|
};
|
|
180
181
|
const isFirstUserMessage = (messages) => messages.filter((message) => message.role === "user").length === 1;
|
|
181
|
-
const createSourceChunks = (docs) => docs.map((doc, index) => ({
|
|
182
|
-
type: "source-url",
|
|
183
|
-
sourceId: `doc-${index}-${doc.slug}`,
|
|
184
|
-
url: doc.url,
|
|
185
|
-
title: doc.title,
|
|
186
|
-
}));
|
|
187
182
|
const buildProxyMessages = async ({ actualMessages, config, currentRoute, defaultLanguage, languages, pageContext, routeSources, }) => {
|
|
188
183
|
if (!isFirstUserMessage(actualMessages)) {
|
|
189
184
|
return { messages: actualMessages, sourceDocs: [] };
|
|
@@ -406,12 +401,7 @@ const createTools = (writer, sources, defaultLanguage, basePath) => {
|
|
|
406
401
|
return `No documentation found for query: "${query}"`;
|
|
407
402
|
}
|
|
408
403
|
for (const [index, doc] of trimmedResults.entries()) {
|
|
409
|
-
writer.write(
|
|
410
|
-
type: "source-url",
|
|
411
|
-
sourceId: `doc-${index}-${doc.slug}`,
|
|
412
|
-
url: doc.url,
|
|
413
|
-
title: doc.title,
|
|
414
|
-
});
|
|
404
|
+
writer.write(createSourceChunk(doc, index));
|
|
415
405
|
}
|
|
416
406
|
const formattedResultsString = trimmedResults
|
|
417
407
|
.map((doc) => `${formatDocForContext(doc)}\n\n---\n`)
|
|
@@ -447,7 +437,15 @@ const createTools = (writer, sources, defaultLanguage, basePath) => {
|
|
|
447
437
|
if (!doc) {
|
|
448
438
|
return `Documentation page not found: "${slug}"`;
|
|
449
439
|
}
|
|
450
|
-
|
|
440
|
+
const content = await doc.source.getPageMarkdown(doc.page);
|
|
441
|
+
const data = getPageData(doc.page);
|
|
442
|
+
const url = getPublicPath(doc.page.url, basePath);
|
|
443
|
+
writer.write(createSourceChunk({
|
|
444
|
+
slug: doc.page.url,
|
|
445
|
+
title: data.title ?? doc.page.url,
|
|
446
|
+
url,
|
|
447
|
+
}));
|
|
448
|
+
return content;
|
|
451
449
|
},
|
|
452
450
|
});
|
|
453
451
|
const list_docs = tool({
|
|
@@ -604,10 +602,26 @@ export const createChatRoute = ({ config, eveAgent, model = DEFAULT_CHAT_MODEL,
|
|
|
604
602
|
return createUIMessageStreamResponse({ stream });
|
|
605
603
|
}
|
|
606
604
|
let processedMessages = actualMessages;
|
|
605
|
+
let localSourceDocs = [];
|
|
607
606
|
if (pageContext && actualMessages.length > 0) {
|
|
608
607
|
const lastMessage = actualMessages.at(-1);
|
|
609
608
|
if (lastMessage?.role === "user") {
|
|
610
609
|
const userQuestion = getMessageText(lastMessage);
|
|
610
|
+
const contextDoc = await getCurrentPageDoc({
|
|
611
|
+
basePath: config.basePath,
|
|
612
|
+
currentRoute,
|
|
613
|
+
lang: getRequestLanguage({
|
|
614
|
+
basePath: config.basePath,
|
|
615
|
+
currentRoute,
|
|
616
|
+
defaultLanguage,
|
|
617
|
+
languages,
|
|
618
|
+
}),
|
|
619
|
+
pageContext,
|
|
620
|
+
sources: routeSources,
|
|
621
|
+
});
|
|
622
|
+
if (contextDoc) {
|
|
623
|
+
localSourceDocs = [contextDoc];
|
|
624
|
+
}
|
|
611
625
|
processedMessages = [
|
|
612
626
|
...actualMessages.slice(0, -1),
|
|
613
627
|
{
|
|
@@ -625,6 +639,9 @@ export const createChatRoute = ({ config, eveAgent, model = DEFAULT_CHAT_MODEL,
|
|
|
625
639
|
const stream = createUIMessageStream({
|
|
626
640
|
originalMessages: messages,
|
|
627
641
|
execute: async ({ writer }) => {
|
|
642
|
+
for (const chunk of createSourceChunks(localSourceDocs)) {
|
|
643
|
+
writer.write(chunk);
|
|
644
|
+
}
|
|
628
645
|
const modelMessages = await convertToModelMessages(processedMessages);
|
|
629
646
|
const result = streamText({
|
|
630
647
|
model,
|
package/dist/routes/llms.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export declare const createLlmsRoute: ({ filterPage, source, sources, transform,
|
|
|
30
30
|
revalidate: false;
|
|
31
31
|
};
|
|
32
32
|
export interface CreateDocsMarkdownRouteOptions {
|
|
33
|
-
config?: Pick<GeistdocsConfig, "basePath" | "defaultLanguage" | "translations">;
|
|
33
|
+
config?: Pick<GeistdocsConfig, "basePath" | "defaultLanguage" | "siteUrl" | "translations">;
|
|
34
34
|
filterStaticParams?: (params: DocsMarkdownParams) => boolean;
|
|
35
35
|
/** Customize the agent-readable Markdown response for missing pages, or disable it. */
|
|
36
36
|
notFound?: false | MarkdownNotFoundOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llms.d.ts","sourceRoot":"","sources":["../../src/routes/llms.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EACL,KAAK,eAAe,EAIrB,MAAM,cAAc,CAAC;AAStB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE1D,KAAK,YAAY,GAAG,qBAAqB,CAAC;AAC1C,KAAK,aAAa,GAAG,WAAW,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"llms.d.ts","sourceRoot":"","sources":["../../src/routes/llms.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;A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C;IAC7D,uFAAuF;IACvF,QAAQ,CAAC,EAAE,KAAK,GAAG,uBAAuB,CAAC;IAC3C,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,SAAS,CAAC,EAAE,iBAAiB,CAAC;CAC/B;AAED,MAAM,WAAW,uBAAuB;IACtC,uDAAuD;IACvD,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE;QAC7B,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,aAAa,CAAC;QACpB,MAAM,EAAE,YAAY,CAAC;KACtB,KAAK,MAAM,CAAC;IACb;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,KAAK,MAAM,CAAC;IACzE,oDAAoD;IACpD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;CAC1B;AAED,eAAO,MAAM,uBAAuB,GAAI,wFAOrC,8BAA8B;mBAqLpB,OAAO,cACJ;QAAE,MAAM,EAAE,OAAO,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;SAAE,CAAC,CAAA;KAAE;yCAmDjE;QACD,MAAM,CAAC,EAAE,OAAO,CAAC;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACrC;;CAgBF,CAAC"}
|
package/dist/routes/llms.js
CHANGED
|
@@ -7,6 +7,7 @@ import { findSmartNotFoundSuggestions, renderSmartNotFoundMarkdown, } from "../i
|
|
|
7
7
|
import { isPageVisibleForSurface } from "../page-visibility.js";
|
|
8
8
|
const INDEX_MARKDOWN_PATTERN = /\/index\.md$/;
|
|
9
9
|
const MARKDOWN_PATTERN = /\.md$/;
|
|
10
|
+
const MARKDOWN_CACHE_CONTROL = "public, max-age=0, s-maxage=86400, stale-while-revalidate=604800";
|
|
10
11
|
const resolveSources = (source, sources, caller) => {
|
|
11
12
|
const resolvedSources = sources ?? (source ? [source] : []);
|
|
12
13
|
if (resolvedSources.length === 0) {
|
|
@@ -158,7 +159,10 @@ export const createLlmsRoute = ({ filterPage, source, sources, transform, }) =>
|
|
|
158
159
|
};
|
|
159
160
|
export const createDocsMarkdownRoute = ({ config, filterStaticParams, notFound: notFoundOptions = {}, source, sources, transform, }) => {
|
|
160
161
|
const routeSources = resolveSources(source, sources, "createDocsMarkdownRoute");
|
|
161
|
-
const routingConfig =
|
|
162
|
+
const routingConfig = {
|
|
163
|
+
...(routeSources[0].routingConfig ?? {}),
|
|
164
|
+
...config,
|
|
165
|
+
};
|
|
162
166
|
const smartNotFoundOptions = notFoundOptions === false ? {} : notFoundOptions;
|
|
163
167
|
const supportedLanguages = new Set([
|
|
164
168
|
routingConfig.defaultLanguage ?? "en",
|
|
@@ -292,7 +296,13 @@ export const createDocsMarkdownRoute = ({ config, filterStaticParams, notFound:
|
|
|
292
296
|
const rendered = await pageSource.getPageMarkdown(page);
|
|
293
297
|
const pageData = page.data;
|
|
294
298
|
const canonicalPath = withBasePath(pageData.canonical ?? page.url, routingConfig.basePath);
|
|
295
|
-
const
|
|
299
|
+
const canonicalUrl = routingConfig.siteUrl
|
|
300
|
+
? new URL(canonicalPath, routingConfig.siteUrl)
|
|
301
|
+
: new URL(canonicalPath, request.url);
|
|
302
|
+
const headers = applyMarkdownHeaders(new Headers({
|
|
303
|
+
"Cache-Control": MARKDOWN_CACHE_CONTROL,
|
|
304
|
+
"Content-Type": "text/markdown",
|
|
305
|
+
}), { canonicalUrl });
|
|
296
306
|
return new Response(transform
|
|
297
307
|
? await transform(rendered, { lang, page, source: pageSource })
|
|
298
308
|
: rendered, {
|
package/dist/source-config.d.ts
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import { type DefaultMDXOptions, defineConfig as defineFumadocsConfig } from "fumadocs-mdx/config";
|
|
2
|
+
import type { Pluggable } from "unified";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
type FumadocsConfigInput = NonNullable<Parameters<typeof defineFumadocsConfig>[0]>;
|
|
4
5
|
export interface GeistdocsSourceConfigOptions {
|
|
5
6
|
mdxOptions?: DefaultMDXOptions;
|
|
6
7
|
plugins?: FumadocsConfigInput["plugins"];
|
|
7
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Builds the remark pipeline from Fumadocs' resolved defaults.
|
|
11
|
+
*
|
|
12
|
+
* `remarkSteps` must run before `remarkHeading`, otherwise the `1. ` prefix
|
|
13
|
+
* that marks a step heading leaks into the heading slug and table of contents.
|
|
14
|
+
* Geistdocs and consumer plugins keep their previous slot ahead of
|
|
15
|
+
* `remarkStructure` so search indexing sees their output.
|
|
16
|
+
*/
|
|
17
|
+
export declare const resolveGeistdocsRemarkPlugins: (defaults: Pluggable[], consumerPlugins?: Pluggable[]) => Pluggable[];
|
|
8
18
|
export declare const geistShikiTheme: {
|
|
9
19
|
name: string;
|
|
10
20
|
type: "dark";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-config.d.ts","sourceRoot":"","sources":["../src/source-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"source-config.d.ts","sourceRoot":"","sources":["../src/source-config.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,iBAAiB,EACtB,YAAY,IAAI,oBAAoB,EAGrC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,KAAK,mBAAmB,GAAG,WAAW,CACpC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAC3C,CAAC;AAEF,MAAM,WAAW,4BAA4B;IAC3C,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,OAAO,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;CAC1C;AAQD;;;;;;;GAOG;AACH,eAAO,MAAM,6BAA6B,GACxC,UAAU,SAAS,EAAE,EACrB,kBAAiB,SAAS,EAAO,KAChC,SAAS,EAeX,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;CAsG3B,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwCrC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;iBAAa,CAAC;AAE9C,eAAO,MAAM,2BAA2B,GACtC,SAAQ,4BAAiC,+CAwB1C,CAAC"}
|
package/dist/source-config.js
CHANGED
|
@@ -1,8 +1,26 @@
|
|
|
1
|
-
import { remarkMdxMermaid } from "fumadocs-core/mdx-plugins";
|
|
1
|
+
import { remarkHeading, remarkMdxMermaid, remarkSteps, remarkStructure, } from "fumadocs-core/mdx-plugins";
|
|
2
2
|
import { defineConfig as defineFumadocsConfig, frontmatterSchema, metaSchema, } from "fumadocs-mdx/config";
|
|
3
3
|
import lastModified from "fumadocs-mdx/plugins/last-modified";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { getLastModified } from "./internal/last-modified.js";
|
|
6
|
+
const pluginOf = (entry) => Array.isArray(entry) ? entry[0] : entry;
|
|
7
|
+
const indexOfPlugin = (list, plugin) => list.findIndex((entry) => pluginOf(entry) === plugin);
|
|
8
|
+
/**
|
|
9
|
+
* Builds the remark pipeline from Fumadocs' resolved defaults.
|
|
10
|
+
*
|
|
11
|
+
* `remarkSteps` must run before `remarkHeading`, otherwise the `1. ` prefix
|
|
12
|
+
* that marks a step heading leaks into the heading slug and table of contents.
|
|
13
|
+
* Geistdocs and consumer plugins keep their previous slot ahead of
|
|
14
|
+
* `remarkStructure` so search indexing sees their output.
|
|
15
|
+
*/
|
|
16
|
+
export const resolveGeistdocsRemarkPlugins = (defaults, consumerPlugins = []) => {
|
|
17
|
+
const list = [...defaults];
|
|
18
|
+
const headingIndex = indexOfPlugin(list, remarkHeading);
|
|
19
|
+
list.splice(headingIndex === -1 ? 0 : headingIndex, 0, remarkSteps);
|
|
20
|
+
const structureIndex = indexOfPlugin(list, remarkStructure);
|
|
21
|
+
list.splice(structureIndex === -1 ? list.length : structureIndex, 0, remarkMdxMermaid, ...consumerPlugins);
|
|
22
|
+
return list;
|
|
23
|
+
};
|
|
6
24
|
export const geistShikiTheme = {
|
|
7
25
|
name: "geist",
|
|
8
26
|
type: "dark",
|
|
@@ -153,7 +171,7 @@ export const defineGeistdocsSourceConfig = (config = {}) => {
|
|
|
153
171
|
...config,
|
|
154
172
|
mdxOptions: {
|
|
155
173
|
...config.mdxOptions,
|
|
156
|
-
remarkPlugins:
|
|
174
|
+
remarkPlugins: (defaults) => resolveGeistdocsRemarkPlugins(defaults, existingRemarkPlugins),
|
|
157
175
|
rehypeCodeOptions: {
|
|
158
176
|
...config.mdxOptions?.rehypeCodeOptions,
|
|
159
177
|
themes: { light: geistShikiTheme, dark: geistShikiTheme },
|