@vercel/geistdocs 2.8.0 → 2.9.1-canary.18e5450
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/assets/icons/icon-fullscreen-close.d.ts +26 -0
- package/dist/assets/icons/icon-fullscreen-close.d.ts.map +1 -0
- package/dist/assets/icons/icon-fullscreen-close.js +25 -0
- package/dist/assets/icons/icon-fullscreen.d.ts +26 -0
- package/dist/assets/icons/icon-fullscreen.d.ts.map +1 -0
- package/dist/assets/icons/icon-fullscreen.js +25 -0
- package/dist/assets/icons/index.d.ts +2 -0
- package/dist/assets/icons/index.d.ts.map +1 -1
- package/dist/assets/icons/index.js +2 -0
- package/dist/cli/index.js +1 -1
- package/dist/internal/chat/context.d.ts +3 -0
- package/dist/internal/chat/context.d.ts.map +1 -1
- package/dist/internal/chat/context.js +7 -0
- package/dist/internal/chat/message.js +1 -1
- package/dist/internal/chat/shell.d.ts.map +1 -1
- package/dist/internal/chat/shell.js +15 -10
- package/dist/internal/mdx-to-markdown.d.ts.map +1 -1
- package/dist/internal/mdx-to-markdown.js +226 -19
- package/dist/internal/page-actions-client.d.ts +1 -1
- package/dist/internal/page-actions-client.js +2 -2
- package/dist/internal/provider-client.d.ts.map +1 -1
- package/dist/internal/provider-client.js +9 -3
- package/dist/pages/docs.d.ts.map +1 -1
- package/dist/pages/docs.js +5 -6
- package/docs/agents.md +1 -1
- package/docs/llms.txt +36 -23
- package/docs/manifest.json +1 -1
- package/docs/pages/agent-readiness.md +1 -2
- package/docs/pages/ask-ai.md +12 -7
- package/docs/pages/deployment.md +8 -6
- package/docs/pages/env.md +15 -8
- package/package.json +6 -6
- package/public-foundation.css +0 -2
- package/shared-theme.css +6 -0
- package/template/.env.example +2 -3
- package/template/AGENTS.md +1 -1
- package/template/content/docs/agent-readiness.mdx +1 -2
- package/template/content/docs/ask-ai.mdx +12 -7
- package/template/content/docs/deployment.mdx +8 -6
- package/template/content/docs/env.mdx +16 -9
- package/template/package.json +1 -1
|
@@ -6,7 +6,9 @@ import remarkStringify from "remark-stringify";
|
|
|
6
6
|
import { unified } from "unified";
|
|
7
7
|
const LEADING_WHITESPACE = /^\s+/;
|
|
8
8
|
const TRAILING_WHITESPACE = /\s+$/;
|
|
9
|
+
const VERSIONED_PATH = /^\/v\d+(?:\/|$)/;
|
|
9
10
|
const WHITESPACE = /\s+/;
|
|
11
|
+
const markdownFragmentParser = unified().use(remarkParse).use(remarkGfm);
|
|
10
12
|
// JSX applies props left to right, so a repeated attribute or a later spread
|
|
11
13
|
// wins at runtime. Read the last literal and distrust it when a spread follows.
|
|
12
14
|
const findAttribute = (node, name) => {
|
|
@@ -38,6 +40,16 @@ function expressionString(node) {
|
|
|
38
40
|
}
|
|
39
41
|
return undefined;
|
|
40
42
|
}
|
|
43
|
+
const expressionBoolean = (node) => node?.type === "Literal" && typeof node.value === "boolean"
|
|
44
|
+
? node.value
|
|
45
|
+
: undefined;
|
|
46
|
+
const expressionScalar = (node) => {
|
|
47
|
+
if (node?.type === "Literal" &&
|
|
48
|
+
(typeof node.value === "string" || typeof node.value === "number")) {
|
|
49
|
+
return String(node.value);
|
|
50
|
+
}
|
|
51
|
+
return expressionString(node);
|
|
52
|
+
};
|
|
41
53
|
const getAttribute = (node, name) => {
|
|
42
54
|
const attribute = findAttribute(node, name);
|
|
43
55
|
if (!attribute) {
|
|
@@ -95,6 +107,15 @@ const paragraph = (value) => ({
|
|
|
95
107
|
children: [{ type: "text", value }],
|
|
96
108
|
type: "paragraph",
|
|
97
109
|
});
|
|
110
|
+
const strongParagraph = (value) => ({
|
|
111
|
+
children: [
|
|
112
|
+
{
|
|
113
|
+
children: [{ type: "text", value }],
|
|
114
|
+
type: "strong",
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
type: "paragraph",
|
|
118
|
+
});
|
|
98
119
|
const inlineCode = (value) => ({
|
|
99
120
|
type: "inlineCode",
|
|
100
121
|
value,
|
|
@@ -342,6 +363,37 @@ const listItem = (label, nested) => ({
|
|
|
342
363
|
spread: false,
|
|
343
364
|
type: "listItem",
|
|
344
365
|
});
|
|
366
|
+
const describedListItem = (label, description, nested) => {
|
|
367
|
+
const descriptionBlocks = description
|
|
368
|
+
? (markdownFragmentParser.parse(description)
|
|
369
|
+
.children ?? [])
|
|
370
|
+
: [];
|
|
371
|
+
const first = descriptionBlocks[0];
|
|
372
|
+
const inlineDescription = first?.type === "paragraph" ? (first.children ?? []) : [];
|
|
373
|
+
const remainingDescription = inlineDescription.length > 0
|
|
374
|
+
? descriptionBlocks.slice(1)
|
|
375
|
+
: descriptionBlocks;
|
|
376
|
+
return {
|
|
377
|
+
children: [
|
|
378
|
+
{
|
|
379
|
+
children: [
|
|
380
|
+
...label,
|
|
381
|
+
...(label.length > 0 && inlineDescription.length > 0
|
|
382
|
+
? [{ type: "text", value: " " }]
|
|
383
|
+
: []),
|
|
384
|
+
...inlineDescription,
|
|
385
|
+
],
|
|
386
|
+
type: "paragraph",
|
|
387
|
+
},
|
|
388
|
+
...remainingDescription,
|
|
389
|
+
...(nested.length > 0
|
|
390
|
+
? [{ children: nested, ordered: false, spread: false, type: "list" }]
|
|
391
|
+
: []),
|
|
392
|
+
],
|
|
393
|
+
spread: remainingDescription.length > 0,
|
|
394
|
+
type: "listItem",
|
|
395
|
+
};
|
|
396
|
+
};
|
|
345
397
|
const describedLabel = (label, description) => {
|
|
346
398
|
if (!description) {
|
|
347
399
|
return label;
|
|
@@ -408,6 +460,89 @@ const propertiesTableNodes = (node) => {
|
|
|
408
460
|
? [{ children: items, ordered: false, spread: false, type: "list" }]
|
|
409
461
|
: [];
|
|
410
462
|
};
|
|
463
|
+
const constraintItems = (entry) => objectElements(objectProperty(entry, "constraints")).flatMap((constraint) => {
|
|
464
|
+
const label = expressionString(objectProperty(constraint, "label"));
|
|
465
|
+
const value = expressionScalar(objectProperty(constraint, "value"));
|
|
466
|
+
if (!(label && value)) {
|
|
467
|
+
return [];
|
|
468
|
+
}
|
|
469
|
+
return [
|
|
470
|
+
listItem([
|
|
471
|
+
{
|
|
472
|
+
children: [{ type: "text", value: `${label}:` }],
|
|
473
|
+
type: "strong",
|
|
474
|
+
},
|
|
475
|
+
{ type: "text", value: ` ${value}` },
|
|
476
|
+
], []),
|
|
477
|
+
];
|
|
478
|
+
});
|
|
479
|
+
const apiVariantItems = (entry) => objectElements(objectProperty(entry, "variants")).flatMap((variant) => {
|
|
480
|
+
const name = expressionString(objectProperty(variant, "name"));
|
|
481
|
+
const description = expressionString(objectProperty(variant, "description"));
|
|
482
|
+
const nested = apiParameterItems(objectElements(objectProperty(variant, "properties")));
|
|
483
|
+
if (!name) {
|
|
484
|
+
return nested;
|
|
485
|
+
}
|
|
486
|
+
return [
|
|
487
|
+
describedListItem([
|
|
488
|
+
{
|
|
489
|
+
children: [{ type: "text", value: name }],
|
|
490
|
+
type: "strong",
|
|
491
|
+
},
|
|
492
|
+
], description, nested),
|
|
493
|
+
];
|
|
494
|
+
});
|
|
495
|
+
function apiParameterItems(entries) {
|
|
496
|
+
return entries.flatMap((entry) => {
|
|
497
|
+
const name = expressionString(objectProperty(entry, "name"));
|
|
498
|
+
const type = expressionString(objectProperty(entry, "type"));
|
|
499
|
+
const description = expressionString(objectProperty(entry, "description"));
|
|
500
|
+
const required = expressionBoolean(objectProperty(entry, "required"));
|
|
501
|
+
const deprecated = expressionBoolean(objectProperty(entry, "deprecated"));
|
|
502
|
+
const label = [];
|
|
503
|
+
const optionalName = name && required === false ? `${name}?` : name;
|
|
504
|
+
if (optionalName || type) {
|
|
505
|
+
label.push(inlineCode([optionalName, type].filter(Boolean).join(": ")));
|
|
506
|
+
}
|
|
507
|
+
if (deprecated) {
|
|
508
|
+
label.push({ type: "text", value: label.length > 0 ? " " : "" }, {
|
|
509
|
+
children: [{ type: "text", value: "Deprecated." }],
|
|
510
|
+
type: "strong",
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
const nestedProperties = apiParameterItems(objectElements(objectProperty(entry, "properties")));
|
|
514
|
+
const arrayItem = objectProperty(entry, "arrayItems");
|
|
515
|
+
const nestedArrayItem = arrayItem?.type === "ObjectExpression"
|
|
516
|
+
? apiParameterItems([arrayItem])
|
|
517
|
+
: [];
|
|
518
|
+
const nested = [
|
|
519
|
+
...constraintItems(entry),
|
|
520
|
+
...nestedProperties,
|
|
521
|
+
...nestedArrayItem,
|
|
522
|
+
...apiVariantItems(entry),
|
|
523
|
+
];
|
|
524
|
+
if (label.length === 0 && !description) {
|
|
525
|
+
return nested;
|
|
526
|
+
}
|
|
527
|
+
return [describedListItem(label, description, nested)];
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
const apiSignatureNodes = (node) => {
|
|
531
|
+
const parameters = objectElements(getAttributeExpression(node, "parameters"));
|
|
532
|
+
if (parameters.length === 0) {
|
|
533
|
+
return endpointNodes(node);
|
|
534
|
+
}
|
|
535
|
+
const title = getAttribute(node, "title");
|
|
536
|
+
return [
|
|
537
|
+
...(title ? [heading([{ type: "text", value: title }], 2)] : []),
|
|
538
|
+
{
|
|
539
|
+
children: apiParameterItems(parameters),
|
|
540
|
+
ordered: false,
|
|
541
|
+
spread: false,
|
|
542
|
+
type: "list",
|
|
543
|
+
},
|
|
544
|
+
];
|
|
545
|
+
};
|
|
411
546
|
const TRIM_NEWLINES = /^\n+|\n+$/g;
|
|
412
547
|
// `Snippet` renders a copyable command or code line from its `text` prop: a
|
|
413
548
|
// string, a static template literal, or an array of lines. The page decides
|
|
@@ -528,34 +663,87 @@ const filesNodes = (node) => {
|
|
|
528
663
|
? [{ children: items, ordered: false, spread: false, type: "list" }]
|
|
529
664
|
: [];
|
|
530
665
|
};
|
|
666
|
+
// True when a prop is written, or a spread could supply it, but its value is
|
|
667
|
+
// not a literal: the rendered value is unknown, so no default may stand in.
|
|
668
|
+
const hasUnreadableAttribute = (node, name, value) => value === undefined &&
|
|
669
|
+
(node.attributes ?? []).some((attribute) => attribute.type === "mdxJsxExpressionAttribute" ||
|
|
670
|
+
(attribute.type === "mdxJsxAttribute" && attribute.name === name));
|
|
671
|
+
const getBooleanAttribute = (node, name) => {
|
|
672
|
+
const attribute = findAttribute(node, name);
|
|
673
|
+
if (!attribute) {
|
|
674
|
+
return undefined;
|
|
675
|
+
}
|
|
676
|
+
if (attribute.value === null) {
|
|
677
|
+
return true;
|
|
678
|
+
}
|
|
679
|
+
return expressionBoolean(getAttributeExpression(node, name));
|
|
680
|
+
};
|
|
531
681
|
const packageNodes = (node) => {
|
|
532
682
|
const packageValue = getAttribute(node, "package") ?? getAttribute(node, "packages");
|
|
533
683
|
const packageExpression = getAttributeExpression(node, "packages");
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
684
|
+
let packages = [];
|
|
685
|
+
if (packageValue) {
|
|
686
|
+
packages = packageValue.split(WHITESPACE).filter(Boolean);
|
|
687
|
+
}
|
|
688
|
+
else if (packageExpression?.type === "ArrayExpression") {
|
|
689
|
+
const entries = packageExpression.elements ?? [];
|
|
690
|
+
const values = entries.map((entry) => expressionString(entry ?? undefined));
|
|
691
|
+
if (values.some((entry) => entry === undefined)) {
|
|
692
|
+
return [];
|
|
693
|
+
}
|
|
694
|
+
packages = values;
|
|
695
|
+
}
|
|
539
696
|
if (packages.length === 0) {
|
|
540
697
|
return [];
|
|
541
698
|
}
|
|
699
|
+
const dev = getBooleanAttribute(node, "dev");
|
|
700
|
+
if (hasUnreadableAttribute(node, "dev", dev)) {
|
|
701
|
+
return [];
|
|
702
|
+
}
|
|
542
703
|
return [
|
|
543
704
|
{
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
705
|
+
lang: "bash",
|
|
706
|
+
type: "code",
|
|
707
|
+
value: `pnpm add ${dev ? "-D " : ""}${packages.join(" ")}`,
|
|
708
|
+
},
|
|
709
|
+
];
|
|
710
|
+
};
|
|
711
|
+
const CODE_LANGUAGES = {
|
|
712
|
+
cURL: "bash",
|
|
713
|
+
JavaScript: "javascript",
|
|
714
|
+
TypeScript: "typescript",
|
|
715
|
+
};
|
|
716
|
+
const codeVariantNodes = (node) => {
|
|
717
|
+
const code = getAttribute(node, "code");
|
|
718
|
+
if (!code) {
|
|
719
|
+
return node.children ?? [];
|
|
720
|
+
}
|
|
721
|
+
const language = getAttribute(node, "language");
|
|
722
|
+
return [
|
|
723
|
+
{
|
|
724
|
+
lang: language
|
|
725
|
+
? (CODE_LANGUAGES[language] ?? language.toLowerCase())
|
|
726
|
+
: undefined,
|
|
727
|
+
type: "code",
|
|
728
|
+
value: code.replace(TRIM_NEWLINES, ""),
|
|
556
729
|
},
|
|
557
730
|
];
|
|
558
731
|
};
|
|
732
|
+
const copyPromptNodes = (node) => {
|
|
733
|
+
const title = getAttribute(node, "title");
|
|
734
|
+
const titleIsDynamic = hasUnreadableAttribute(node, "title", title);
|
|
735
|
+
const body = blockChildren(node, true);
|
|
736
|
+
const text = getAttribute(node, "text");
|
|
737
|
+
const content = body.length > 0 ? body : [];
|
|
738
|
+
if (content.length === 0 && text) {
|
|
739
|
+
content.push(paragraph(text));
|
|
740
|
+
}
|
|
741
|
+
const titleNodes = title ? [strongParagraph(title)] : [];
|
|
742
|
+
if (title === undefined && !titleIsDynamic) {
|
|
743
|
+
titleNodes.push(strongParagraph("Prompt for coding agents"));
|
|
744
|
+
}
|
|
745
|
+
return [...titleNodes, ...content];
|
|
746
|
+
};
|
|
559
747
|
const videoNodes = (node) => {
|
|
560
748
|
const url = getAttribute(node, "src") ?? getAttribute(node, "url");
|
|
561
749
|
if (!url) {
|
|
@@ -595,6 +783,19 @@ const endpointNodes = (node) => {
|
|
|
595
783
|
? [heading([inlineCode(`${method.toUpperCase()} ${path}`)])]
|
|
596
784
|
: [];
|
|
597
785
|
};
|
|
786
|
+
const endpointDisplayNodes = (node) => {
|
|
787
|
+
const method = getAttribute(node, "method");
|
|
788
|
+
const path = getAttribute(node, "path");
|
|
789
|
+
const versionPrefix = getAttribute(node, "versionPrefix");
|
|
790
|
+
if (hasUnreadableAttribute(node, "versionPrefix", versionPrefix)) {
|
|
791
|
+
return [];
|
|
792
|
+
}
|
|
793
|
+
const fullPath = path
|
|
794
|
+
? `${versionPrefix ?? (VERSIONED_PATH.test(path) ? "" : "/v1")}${path}`
|
|
795
|
+
: undefined;
|
|
796
|
+
const label = method?.toUpperCase() === "DELETE" ? "DEL" : method?.toUpperCase();
|
|
797
|
+
return method && path ? [heading([inlineCode(`${label}${fullPath}`)])] : [];
|
|
798
|
+
};
|
|
598
799
|
const themeAwareImageNodes = (node) => {
|
|
599
800
|
const light = getAttributeExpression(node, "light");
|
|
600
801
|
const dark = getAttributeExpression(node, "dark");
|
|
@@ -672,15 +873,17 @@ const buttonNodes = (node) => {
|
|
|
672
873
|
const COMPONENT_REPLACERS = {
|
|
673
874
|
Accordion: (node) => labelledContentNodes(node, ["title"]),
|
|
674
875
|
APIPage: apiOperationNodes,
|
|
675
|
-
APISignature:
|
|
876
|
+
APISignature: apiSignatureNodes,
|
|
676
877
|
Button: buttonNodes,
|
|
677
878
|
ButtonLink: linkNodes,
|
|
678
879
|
Callout: (node) => [calloutNode(node)],
|
|
679
880
|
Card: cardNodes,
|
|
680
881
|
CardPlayer: cardNodes,
|
|
681
882
|
ChatGeneration: chatGenerationNodes,
|
|
883
|
+
CodeVariant: codeVariantNodes,
|
|
884
|
+
CopyPrompt: copyPromptNodes,
|
|
682
885
|
Details: (node) => blockChildren(node, true),
|
|
683
|
-
EndpointDisplay:
|
|
886
|
+
EndpointDisplay: endpointDisplayNodes,
|
|
684
887
|
ExampleLinks: exampleLinksNodes,
|
|
685
888
|
GithubLink: githubLinkNodes,
|
|
686
889
|
Image: imageNodes,
|
|
@@ -691,6 +894,10 @@ const COMPONENT_REPLACERS = {
|
|
|
691
894
|
MDXImage: imageNodes,
|
|
692
895
|
Mermaid: mermaidNodes,
|
|
693
896
|
PackageInstall: packageNodes,
|
|
897
|
+
PromptLink: (node) => {
|
|
898
|
+
const text = getAttribute(node, "text");
|
|
899
|
+
return text ? [paragraph(text)] : [];
|
|
900
|
+
},
|
|
694
901
|
PropertiesTable: propertiesTableNodes,
|
|
695
902
|
Snippet: snippetNodes,
|
|
696
903
|
Summary: summaryNodes,
|
|
@@ -5,7 +5,7 @@ interface PageActionsProps {
|
|
|
5
5
|
/**
|
|
6
6
|
* Which variant to render. Defaults to both. Use "desktop" to render only
|
|
7
7
|
* the dropdown (beside the title) and "mobile" to render only the inline
|
|
8
|
-
* action row (below the
|
|
8
|
+
* action row (below the title).
|
|
9
9
|
*/
|
|
10
10
|
only?: "desktop" | "mobile";
|
|
11
11
|
page: {
|
|
@@ -172,7 +172,7 @@ const FeedbackAction = ({ siteId }) => {
|
|
|
172
172
|
: "text-gray-900 hover:text-gray-1000", onClick: () => setEmotion(entry.name), size: "small", type: "unstyled", typeName: "button", children: [entry.emoji, _jsx("span", { className: "sr-only", children: entry.name })] }, entry.name))) }), _jsx(Button, { disabled: isPending || !emotion || !message, size: "small", typeName: "submit", children: "Send" })] })] })) }) })] }));
|
|
173
173
|
};
|
|
174
174
|
// The mobile action row: three primary actions rendered inline below the
|
|
175
|
-
// page
|
|
175
|
+
// page title.
|
|
176
176
|
const InlinePageActions = ({ askAIEnabled, checked, copyEnabled, onAskAI, onCopy, onPrefetchMarkdown, onViewMarkdown, }) => {
|
|
177
177
|
const CopyStateIcon = checked ? IconCheck : IconCopy;
|
|
178
178
|
let copyLabel = "Copy for LLM";
|
|
@@ -241,7 +241,7 @@ export const GeistdocsPageActions = ({ config, page, only, }) => {
|
|
|
241
241
|
openWithPage({ title: page.title, url: page.url });
|
|
242
242
|
};
|
|
243
243
|
// Desktop variant aligns beside the title (self-end); the mobile variant is
|
|
244
|
-
// rendered below the
|
|
244
|
+
// rendered below the title and left-aligned.
|
|
245
245
|
const rootClassName = only === "mobile" ? "@min-[961px]:hidden" : "self-end @max-[960px]:hidden";
|
|
246
246
|
return (_jsxs("div", { className: rootClassName, onFocusCapture: preloadChat, onPointerEnter: preloadChat, children: [showDesktop ? (_jsx(DesktopPageActions, { askAIEnabled: askAIEnabled, checked: checked, copyEnabled: copyEnabled, editSourceEnabled: editSourceEnabled, editSourceUrl: editSourceUrl, isMobile: isMobile, menuView: menuView, onAskAI: onAskAI, onCopy: handleCopy, onPrefetchMarkdown: prefetchMarkdown, onViewMarkdown: handleViewMarkdown, openInChatEnabled: openInChatEnabled, openInChatRef: openInChatRef, otherProviders: otherProviders, providersBackRef: providersBackRef, query: query, setMenuView: setMenuView, v0Provider: v0Provider })) : null, showMobile && (copyEnabled || askAIEnabled) ? (_jsx(InlinePageActions, { askAIEnabled: askAIEnabled, checked: checked, copyEnabled: copyEnabled, onAskAI: onAskAI, onCopy: handleCopy, onPrefetchMarkdown: prefetchMarkdown, onViewMarkdown: handleViewMarkdown })) : null, _jsx("span", { "aria-live": "polite", className: "sr-only", children: checked ? "Page copied" : "" })] }));
|
|
247
247
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-client.d.ts","sourceRoot":"","sources":["../../src/internal/provider-client.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EACL,KAAK,cAAc,EAKpB,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAKjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAUjD,KAAK,kBAAkB,GAAG,WAAW,CACnC,cAAc,CAAC,OAAO,YAAY,CAAC,CAAC,QAAQ,CAAC,CAC9C,CAAC;AAEF,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,YAAY,CAAC,EAAE,QAAQ,CAAC;IAC3D,MAAM,EAAE,eAAe,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,MAAM,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,GAAG;QAC7C,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC;KACjE,CAAC;CACH;
|
|
1
|
+
{"version":3,"file":"provider-client.d.ts","sourceRoot":"","sources":["../../src/internal/provider-client.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EACL,KAAK,cAAc,EAKpB,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAKjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAUjD,KAAK,kBAAkB,GAAG,WAAW,CACnC,cAAc,CAAC,OAAO,YAAY,CAAC,CAAC,QAAQ,CAAC,CAC9C,CAAC;AAEF,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,YAAY,CAAC,EAAE,QAAQ,CAAC;IAC3D,MAAM,EAAE,eAAe,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,MAAM,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,GAAG;QAC7C,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC;KACjE,CAAC;CACH;AA+FD,eAAO,MAAM,iBAAiB,GAAI,OAAO,sBAAsB,4CAQ9D,CAAC"}
|
|
@@ -17,7 +17,7 @@ const GeistdocsChatShell = lazy(() => import("./chat/shell").then(({ GeistdocsCh
|
|
|
17
17
|
})));
|
|
18
18
|
const GeistdocsProviderInner = ({ config, search, theme: _theme, lang, ...props }) => {
|
|
19
19
|
const { i18n, i18nProvider } = createGeistdocsI18n(config);
|
|
20
|
-
const { enabled, hasBeenOpened, isOpen, setIsOpen } = useGeistdocsChatContext();
|
|
20
|
+
const { enabled, hasBeenOpened, isExpanded, isOpen, setIsExpanded, setIsOpen, } = useGeistdocsChatContext();
|
|
21
21
|
const isMobile = useIsMobile();
|
|
22
22
|
useEffect(() => {
|
|
23
23
|
if (!enabled) {
|
|
@@ -26,7 +26,13 @@ const GeistdocsProviderInner = ({ config, search, theme: _theme, lang, ...props
|
|
|
26
26
|
const handleKeyDown = (event) => {
|
|
27
27
|
if (event.key === "Escape" && isOpen) {
|
|
28
28
|
event.preventDefault();
|
|
29
|
-
|
|
29
|
+
// The first Escape returns an expanded desktop panel to the sidebar.
|
|
30
|
+
if (isExpanded && !isMobile) {
|
|
31
|
+
setIsExpanded(false);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
setIsOpen(false);
|
|
35
|
+
}
|
|
30
36
|
return;
|
|
31
37
|
}
|
|
32
38
|
if ((event.metaKey || event.ctrlKey) &&
|
|
@@ -39,7 +45,7 @@ const GeistdocsProviderInner = ({ config, search, theme: _theme, lang, ...props
|
|
|
39
45
|
};
|
|
40
46
|
document.addEventListener("keydown", handleKeyDown, true);
|
|
41
47
|
return () => document.removeEventListener("keydown", handleKeyDown, true);
|
|
42
|
-
}, [enabled, isOpen, setIsOpen]);
|
|
48
|
+
}, [enabled, isExpanded, isMobile, isOpen, setIsExpanded, setIsOpen]);
|
|
43
49
|
// fumadocs spreads the provider's `search.options` onto the dialog, which is
|
|
44
50
|
// how a consumer reaches `tag`. Typed here so it survives the hand-off.
|
|
45
51
|
const SearchDialogComponent = useCallback((searchProps) => (_jsx(GeistdocsSearchDialog, { basePath: config.basePath, ...searchProps })), [config.basePath]);
|
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":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/pages/docs.tsx"],"names":[],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AE,MAAM,CAAC;QAChB,aAAa,EAAE,MAAM,CAAC;KACvB,KAAK,SAAS,CAAC;IAChB,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE;QACtB,IAAI,EAAE,YAAY,CAAC;QACnB,UAAU,EAAE,OAAO,cAAc,CAAC;QAClC,IAAI,EAAE,aAAa,CAAC;QACpB,MAAM,EAAE,YAAY,CAAC;KACtB,KAAK,YAAY,CAAC;IACnB,MAAM,EAAE,YAAY,CAAC;IACrB,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC,qBAAqB,CAAC,EAAE,cAAc,CACpC,OAAO,gBAAgB,CACxB,CAAC,uBAAuB,CAAC,CAAC;CAC5B;AAmDD,eAAO,MAAM,cAAc,GAAI,MAAM,SAAS,cAAc,GAAG,cAAc,EAAE,0MAgB5E,qBAAqB,CAAC,MAAM,CAAC;uBAuOJ;QAAE,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;KAAE;0BAvKlB,MAAM;;oCAqLtC;QACD,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;KACzB,KAAG,OAAO,CAAC,QAAQ,CAAC;CAqDtB,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;CAA4B,CAAC"}
|
package/dist/pages/docs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import Link from "fumadocs-core/link";
|
|
3
|
-
import { DocsBody as FumadocsDocsBody,
|
|
3
|
+
import { DocsBody as FumadocsDocsBody, DocsPage as FumadocsDocsPage, DocsTitle as FumadocsDocsTitle, } from "fumadocs-ui/layouts/docs/page";
|
|
4
4
|
import { createRelativeLink } from "fumadocs-ui/mdx";
|
|
5
5
|
import { notFound } from "next/navigation";
|
|
6
6
|
import { cache, } from "react";
|
|
@@ -30,15 +30,14 @@ const renderPrefetchedDocsLink = (siteUrl, basePath, { children, className, href
|
|
|
30
30
|
};
|
|
31
31
|
export const resolvePageMarkdownUrl = (options) => resolveInternalPageMarkdownUrl(options);
|
|
32
32
|
/**
|
|
33
|
-
* The page's article parts carry `data-geistdocs-article` (`title`,
|
|
34
|
-
* `
|
|
33
|
+
* The page's visible article parts carry `data-geistdocs-article` (`title`,
|
|
34
|
+
* `body`) so tools that read the rendered HTML (docs
|
|
35
35
|
* crawlers, parity checks against the Markdown route) can select the
|
|
36
36
|
* article without depending on Fumadocs' element ids or on class names.
|
|
37
37
|
* The marked elements hold content only: page actions, breadcrumbs, the
|
|
38
38
|
* table of contents, and the previous/next footer sit outside them.
|
|
39
39
|
*/
|
|
40
40
|
const DocsTitle = ({ className, ...props }) => (_jsx(FumadocsDocsTitle, { className: cn("mb-4 text-balance", className), "data-geistdocs-article": "title", ...props }));
|
|
41
|
-
const DocsDescription = ({ className, ...props }) => (_jsx(FumadocsDocsDescription, { className: cn("text-gray-900", className), "data-geistdocs-article": "description", ...props }));
|
|
42
41
|
const DocsBody = ({ className, ...props }) => (_jsx(FumadocsDocsBody, { className: cn("mx-auto w-full", className), "data-geistdocs-article": "body", ...props }));
|
|
43
42
|
/** App-provided footer content below the table-of-contents actions. */
|
|
44
43
|
const TocFooterSlot = ({ children }) => children ? _jsx("div", { className: "mt-4", children: children }) : null;
|
|
@@ -168,12 +167,12 @@ export const createDocsPage = ({ canViewPage, config, source, mdx, pageActions =
|
|
|
168
167
|
page,
|
|
169
168
|
pageUrl,
|
|
170
169
|
publicPageUrl,
|
|
171
|
-
}), _jsxs("div", { className:
|
|
170
|
+
}), _jsxs("div", { className: "mb-8 flex flex-col-reverse gap-4 md:flex-row md:items-end md:justify-between", children: [_jsx(DocsTitle, { className: "mb-0 min-w-0", children: data.title }), _jsx(GeistdocsPageActions, { config: pageActions.config, only: "desktop", page: {
|
|
172
171
|
markdownUrl,
|
|
173
172
|
path: page.path,
|
|
174
173
|
title: data.title,
|
|
175
174
|
url: publicPageUrl,
|
|
176
|
-
} })] }), _jsx(
|
|
175
|
+
} })] }), _jsx("div", { className: "-mt-6 mb-4 @min-[961px]:hidden", children: _jsx(GeistdocsPageActions, { config: pageActions.config, only: "mobile", page: {
|
|
177
176
|
markdownUrl,
|
|
178
177
|
path: page.path,
|
|
179
178
|
title: data.title,
|
package/docs/agents.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Geistdocs Package Docs
|
|
2
2
|
|
|
3
|
-
These docs are bundled with `@vercel/geistdocs` 2.
|
|
3
|
+
These docs are bundled with `@vercel/geistdocs` 2.9.1-canary.18e5450 so agents can understand the installed package without web access.
|
|
4
4
|
They are generated from `apps/template/content/docs` during the package build.
|
|
5
5
|
|
|
6
6
|
## How to use these files
|
package/docs/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Geistdocs Package Documentation
|
|
2
2
|
|
|
3
|
-
These docs are bundled with `@vercel/geistdocs` 2.
|
|
3
|
+
These docs are bundled with `@vercel/geistdocs` 2.9.1-canary.18e5450.
|
|
4
4
|
They describe how to build package-backed Geistdocs sites and how to use the package APIs from generated project adapters.
|
|
5
5
|
|
|
6
6
|
## Documentation Index
|
|
@@ -340,7 +340,7 @@ related:
|
|
|
340
340
|
|
|
341
341
|
Geistdocs uses environment variables to configure Ask AI, optional Mixedbread retrieval, optional Vertex-backed proxy mode, eve agent session cookie signing, and production URL behavior.
|
|
342
342
|
|
|
343
|
-
Review this Geistdocs project and help me configure the required environment variables. Check whether `AI_GATEWAY_API_KEY`, `MXBAI_API_KEY`, `MXBAI_STORE_ID`, `GEISTDOCS_CHAT_PROXY_URL`, `GEISTDOCS_CHAT_SECRET`, and `NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL` are needed for the features I enabled, then tell me where to set them locally and on Vercel.
|
|
343
|
+
Review this Geistdocs project and help me configure the required environment variables. Check whether `AI_GATEWAY_API_KEY`, `MXBAI_API_KEY`, `MXBAI_STORE_ID`, `GEISTDOCS_CHAT_PROXY_URL`, `GEISTDOCS_CHAT_PROXY_TOKEN`, `GEISTDOCS_CHAT_SECRET`, and `NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL` are needed for the features I enabled, then tell me where to set them locally and on Vercel.
|
|
344
344
|
|
|
345
345
|
## `AI_GATEWAY_API_KEY`
|
|
346
346
|
|
|
@@ -374,20 +374,27 @@ When this variable is set, the site does not need `AI_GATEWAY_API_KEY` for Ask A
|
|
|
374
374
|
|
|
375
375
|
## `GEISTDOCS_CHAT_PROXY_TOKEN`
|
|
376
376
|
|
|
377
|
-
|
|
377
|
+
The server-only bearer token that authenticates a Geistdocs site to its chat proxy. The central Geistdocs platform proxy requires this value.
|
|
378
378
|
|
|
379
|
-
|
|
379
|
+
Generate a random token containing at least 32 bytes:
|
|
380
|
+
|
|
381
|
+
```bash title="Terminal"
|
|
382
|
+
openssl rand -base64 32
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
Set the generated value as `GEISTDOCS_CHAT_PROXY_TOKEN` on each approved Geistdocs site and as `GEISTDOCS_VERTEX_PROXY_TOKEN` on the platform proxy deployment. Never expose either value with a `NEXT_PUBLIC_` prefix.
|
|
380
386
|
|
|
381
387
|
## Vertex-backed proxy setup
|
|
382
388
|
|
|
383
389
|
To route Ask AI through Vertex:
|
|
384
390
|
|
|
385
|
-
1.
|
|
386
|
-
2.
|
|
387
|
-
3. In
|
|
388
|
-
4.
|
|
391
|
+
1. Generate a random token with `openssl rand -base64 32`.
|
|
392
|
+
2. Set the token as `GEISTDOCS_VERTEX_PROXY_TOKEN` on the platform proxy deployment.
|
|
393
|
+
3. In the Vertex deployment's Deployment Protection settings, add the Geistdocs platform Vercel project as a Trusted Source.
|
|
394
|
+
4. In each approved Geistdocs site, set `GEISTDOCS_CHAT_PROXY_URL` to the platform proxy URL, including `/vertex`.
|
|
395
|
+
5. Set the same token as `GEISTDOCS_CHAT_PROXY_TOKEN` on each approved Geistdocs site.
|
|
389
396
|
|
|
390
|
-
The
|
|
397
|
+
The bearer token authenticates each Geistdocs site to the platform proxy. The platform proxy then authenticates to Vertex with Vercel OIDC and Trusted Sources. The `/vertex` route accepts request bodies up to 1,000,000 bytes, up to 200 messages, and only `platform: "vercel"`.
|
|
391
398
|
|
|
392
399
|
## `GEISTDOCS_CHAT_SECRET`
|
|
393
400
|
|
|
@@ -487,12 +494,14 @@ To deploy from the Vercel dashboard:
|
|
|
487
494
|
|
|
488
495
|
If your site routes Ask AI through the central Vertex-backed proxy, configure both the Geistdocs site and the Vertex deployment before testing production chat.
|
|
489
496
|
|
|
490
|
-
1.
|
|
491
|
-
2.
|
|
492
|
-
3.
|
|
493
|
-
4.
|
|
497
|
+
1. Generate a random token containing at least 32 bytes with `openssl rand -base64 32`.
|
|
498
|
+
2. Set the token as `GEISTDOCS_VERTEX_PROXY_TOKEN` on the platform proxy deployment.
|
|
499
|
+
3. Set `GEISTDOCS_CHAT_PROXY_URL` on the Geistdocs site to the platform proxy URL, including `/vertex`.
|
|
500
|
+
4. Set the same token as `GEISTDOCS_CHAT_PROXY_TOKEN` on the Geistdocs site.
|
|
501
|
+
5. Add the Geistdocs platform Vercel project as a Trusted Source in the Vertex deployment's Deployment Protection settings.
|
|
502
|
+
6. Confirm the platform proxy can forward the Vercel OIDC token to Vertex in `x-vercel-trusted-oidc-idp-token`.
|
|
494
503
|
|
|
495
|
-
The Geistdocs site does not need Vertex credentials. The platform proxy authenticates to Vertex with Vercel OIDC and Trusted Sources.
|
|
504
|
+
The Geistdocs site does not need Vertex credentials. The site authenticates to the platform proxy with the shared bearer token, and the platform proxy authenticates to Vertex with Vercel OIDC and Trusted Sources.
|
|
496
505
|
|
|
497
506
|
|
|
498
507
|
---
|
|
@@ -3799,12 +3808,11 @@ Publishing the document makes `/api/chat` discoverable for programmatic use. Tha
|
|
|
3799
3808
|
|
|
3800
3809
|
## Select the article in rendered HTML
|
|
3801
3810
|
|
|
3802
|
-
Docs pages mark the article
|
|
3811
|
+
Docs pages mark the visible article parts in their HTML, so a tool that reads the rendered page (a crawler, or a check that compares the page with its Markdown route) can select the content without depending on Fumadocs element IDs or class names. The frontmatter description remains available through metadata and AI-readable routes, but is not repeated below the page title.
|
|
3803
3812
|
|
|
3804
3813
|
| Attribute | Element |
|
|
3805
3814
|
| --- | --- |
|
|
3806
3815
|
| `data-geistdocs-article="title"` | The page's `h1` |
|
|
3807
|
-
| `data-geistdocs-article="description"` | The description paragraph, when the page has a description |
|
|
3808
3816
|
| `data-geistdocs-article="body"` | The rendered MDX body |
|
|
3809
3817
|
|
|
3810
3818
|
Page actions, breadcrumbs, the table of contents, and the previous/next links sit outside these elements, so their text never mixes with the article's.
|
|
@@ -3846,7 +3854,7 @@ The AI chat assistant is available in two ways:
|
|
|
3846
3854
|
|
|
3847
3855
|
### 1. Per-Page Quick Access
|
|
3848
3856
|
|
|
3849
|
-
Each documentation page has an "Ask AI about this page" action in the page actions menu beside the title, and in the action row below the
|
|
3857
|
+
Each documentation page has an "Ask AI about this page" action in the page actions menu beside the title, and in the action row below the title on mobile. When a reader selects it, Ask AI:
|
|
3850
3858
|
|
|
3851
3859
|
1. Clears the current conversation, including the history stored in the browser, and opens the chat
|
|
3852
3860
|
2. Shows a card above the prompt input that names the page. Readers can remove the card to ask without the page
|
|
@@ -3872,6 +3880,7 @@ Once open, users can:
|
|
|
3872
3880
|
- Ask questions about any part of your documentation
|
|
3873
3881
|
- View the documentation pages used as sources for each answer
|
|
3874
3882
|
- Copy an answer as Markdown
|
|
3883
|
+
- Expand the desktop panel to fill the viewport
|
|
3875
3884
|
- Get step-by-step guidance on complex topics
|
|
3876
3885
|
|
|
3877
3886
|
## Control Ask AI from your own components
|
|
@@ -4125,20 +4134,22 @@ The `model` option only applies in AI Gateway mode. In proxy mode, the Vertex-ba
|
|
|
4125
4134
|
Use proxy mode when Ask AI should route model requests through a central Vertex-backed service instead of calling AI Gateway from each site.
|
|
4126
4135
|
|
|
4127
4136
|
1. Deploy or use the central Geistdocs platform proxy that exposes `POST /vertex`.
|
|
4128
|
-
2.
|
|
4129
|
-
3. Set `
|
|
4137
|
+
2. Generate a random token containing at least 32 bytes with `openssl rand -base64 32`.
|
|
4138
|
+
3. Set the token as `GEISTDOCS_VERTEX_PROXY_TOKEN` on the platform proxy deployment.
|
|
4139
|
+
4. Configure the Vertex deployment to trust the Geistdocs platform Vercel project with Deployment Protection Trusted Sources.
|
|
4140
|
+
5. Set `GEISTDOCS_CHAT_PROXY_URL` on the Geistdocs site to the platform proxy URL, including `/vertex`:
|
|
4130
4141
|
|
|
4131
4142
|
```txt
|
|
4132
4143
|
https://<geistdocs-platform-deployment>/vertex
|
|
4133
4144
|
```
|
|
4134
4145
|
|
|
4135
|
-
|
|
4146
|
+
6. Set the same token as `GEISTDOCS_CHAT_PROXY_TOKEN` on the Geistdocs site.
|
|
4136
4147
|
|
|
4137
4148
|
When `GEISTDOCS_CHAT_PROXY_URL` is set, Geistdocs searches local docs on the first user message, injects the attached page (or the current page when no page is attached) and related docs into the final user message, forwards `{ messages, platform: "vercel" }` to the proxy, and streams the AI SDK UI stream response back to the browser. Set [`contextInjection: "page-only"`](#choose-what-context-the-proxy-or-agent-receives) to forward messages as sent and inline only a page the reader attaches.
|
|
4138
4149
|
|
|
4139
4150
|
The proxy request also carries the reader's `x-client-ja4` and `x-client-ip` values, read from the incoming `x-vercel-ja4-digest` and `x-forwarded-for` headers, unless `proxy.headers` sets them. `proxy.headers` accepts a static object or a function that receives the incoming chat `Request`; see [Forward per-request values in upstream headers](#forward-per-request-values-in-upstream-headers).
|
|
4140
4151
|
|
|
4141
|
-
The platform proxy forwards a Vercel OIDC token to Vertex in the `x-vercel-trusted-oidc-idp-token` header. The Vertex deployment should validate the caller through Trusted Sources; the Geistdocs site does not need a Vertex API key.
|
|
4152
|
+
The Geistdocs site authenticates to the platform proxy with the server-only bearer token. The platform proxy forwards a Vercel OIDC token to Vertex in the `x-vercel-trusted-oidc-idp-token` header. The Vertex deployment should validate the caller through Trusted Sources; the Geistdocs site does not need a Vertex API key.
|
|
4142
4153
|
|
|
4143
4154
|
### Hosted eve agent mode
|
|
4144
4155
|
|
|
@@ -4461,6 +4472,8 @@ export const { POST, maxDuration } = createChatRoute({
|
|
|
4461
4472
|
});
|
|
4462
4473
|
```
|
|
4463
4474
|
|
|
4475
|
+
In Vertex-backed proxy mode, the platform `/vertex` route also limits requests to 1,000,000 bytes and 200 messages. Increasing `maxRequestBytes` or `maxMessages` above those values does not raise the platform limits.
|
|
4476
|
+
|
|
4464
4477
|
Request size limits don't control how often a client can call the route. `/api/chat` is public, and every accepted request calls a model or agent on your account, so wrap the route with your own rate limiting. For example, install `@vercel/firewall`, create a [Firewall rate limit rule](https://vercel.com/docs/vercel-firewall/vercel-waf/rate-limiting-sdk) with the rate limit ID `ask-ai`, and check it before calling `POST`:
|
|
4465
4478
|
|
|
4466
4479
|
```ts title="app/api/chat/route.ts"
|
|
@@ -4542,8 +4555,8 @@ Ask AI accepts text questions only. It does not support file or image attachment
|
|
|
4542
4555
|
|
|
4543
4556
|
The chat interface adapts to different screen sizes:
|
|
4544
4557
|
|
|
4545
|
-
- **Desktop**: Slides in from the right side as a sidebar panel
|
|
4546
|
-
- **Mobile**: Opens as a bottom drawer.
|
|
4558
|
+
- **Desktop**: Slides in from the right side as a sidebar panel. Select **Expand chat** in the panel header to fill the viewport, which gives long answers and code blocks more width without losing the conversation. Select **Collapse chat** or press `Escape` to return to the sidebar. Closing the chat also returns it to the sidebar, so the next open starts there.
|
|
4559
|
+
- **Mobile**: Opens as a bottom drawer. The drawer has no expanded view.
|
|
4547
4560
|
|
|
4548
4561
|
## Configuration
|
|
4549
4562
|
|
package/docs/manifest.json
CHANGED
|
@@ -166,12 +166,11 @@ Publishing the document makes `/api/chat` discoverable for programmatic use. Tha
|
|
|
166
166
|
|
|
167
167
|
## Select the article in rendered HTML
|
|
168
168
|
|
|
169
|
-
Docs pages mark the article
|
|
169
|
+
Docs pages mark the visible article parts in their HTML, so a tool that reads the rendered page (a crawler, or a check that compares the page with its Markdown route) can select the content without depending on Fumadocs element IDs or class names. The frontmatter description remains available through metadata and AI-readable routes, but is not repeated below the page title.
|
|
170
170
|
|
|
171
171
|
| Attribute | Element |
|
|
172
172
|
| --- | --- |
|
|
173
173
|
| `data-geistdocs-article="title"` | The page's `h1` |
|
|
174
|
-
| `data-geistdocs-article="description"` | The description paragraph, when the page has a description |
|
|
175
174
|
| `data-geistdocs-article="body"` | The rendered MDX body |
|
|
176
175
|
|
|
177
176
|
Page actions, breadcrumbs, the table of contents, and the previous/next links sit outside these elements, so their text never mixes with the article's.
|