@vercel/geistdocs 2.16.0 → 3.0.1-canary.85002c3

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.
Files changed (59) hide show
  1. package/dist/cli/index.js +1 -1
  2. package/dist/config.d.ts +12 -0
  3. package/dist/config.d.ts.map +1 -1
  4. package/dist/internal/lazy-mdx-components.d.ts +0 -2
  5. package/dist/internal/lazy-mdx-components.d.ts.map +1 -1
  6. package/dist/internal/lazy-mdx-components.js +0 -1
  7. package/dist/internal/mermaid-source.d.ts +5 -0
  8. package/dist/internal/mermaid-source.d.ts.map +1 -0
  9. package/dist/internal/mermaid-source.js +5 -0
  10. package/dist/internal/page-action-options.d.ts +9 -4
  11. package/dist/internal/page-action-options.d.ts.map +1 -1
  12. package/dist/internal/page-action-options.js +19 -12
  13. package/dist/internal/page-actions-client.d.ts.map +1 -1
  14. package/dist/internal/page-actions-client.js +19 -112
  15. package/dist/internal/page-actions-gate.d.ts +6 -0
  16. package/dist/internal/page-actions-gate.d.ts.map +1 -1
  17. package/dist/internal/page-actions-gate.js +11 -9
  18. package/dist/internal/page-actions-menu-client.d.ts +8 -0
  19. package/dist/internal/page-actions-menu-client.d.ts.map +1 -0
  20. package/dist/internal/page-actions-menu-client.js +105 -0
  21. package/dist/internal/page-markdown.d.ts +3 -0
  22. package/dist/internal/page-markdown.d.ts.map +1 -0
  23. package/dist/internal/page-markdown.js +45 -0
  24. package/dist/internal/sidebar.d.ts.map +1 -1
  25. package/dist/internal/sidebar.js +4 -1
  26. package/dist/internal/toc-actions-client.d.ts +3 -1
  27. package/dist/internal/toc-actions-client.d.ts.map +1 -1
  28. package/dist/internal/toc-actions-client.js +7 -9
  29. package/dist/mdx.js +3 -2
  30. package/dist/pages/docs.d.ts +6 -1
  31. package/dist/pages/docs.d.ts.map +1 -1
  32. package/dist/pages/docs.js +11 -6
  33. package/docs/agents.md +2 -3
  34. package/docs/llms.txt +31 -180
  35. package/docs/manifest.json +2 -11
  36. package/docs/pages/changelog.md +1 -1
  37. package/docs/pages/components/index.md +0 -1
  38. package/docs/pages/configuration.md +24 -3
  39. package/docs/pages/edit-on-github.md +1 -1
  40. package/docs/pages/index.md +0 -29
  41. package/docs/pages/md.md +1 -1
  42. package/docs/pages/migration.md +1 -1
  43. package/docs/pages/syntax.md +1 -107
  44. package/docs/sitemap.md +1 -2
  45. package/package.json +12 -6
  46. package/template/app/[lang]/docs/[[...slug]]/page.tsx +1 -0
  47. package/template/content/docs/changelog.mdx +1 -1
  48. package/template/content/docs/components/index.mdx +0 -1
  49. package/template/content/docs/components/meta.json +0 -1
  50. package/template/content/docs/configuration.mdx +24 -3
  51. package/template/content/docs/edit-on-github.mdx +1 -1
  52. package/template/content/docs/index.mdx +0 -28
  53. package/template/content/docs/md.mdx +1 -1
  54. package/template/content/docs/migration.mdx +1 -1
  55. package/template/content/docs/syntax.cn.mdx +1 -107
  56. package/template/content/docs/syntax.mdx +1 -107
  57. package/template/package.json +1 -2
  58. package/docs/pages/components/mermaid.md +0 -29
  59. package/template/content/docs/components/mermaid.mdx +0 -25
@@ -0,0 +1,105 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useCopyButton } from "fumadocs-ui/utils/use-copy-button";
4
+ import { useRef, useState, } from "react";
5
+ import { IconAcronymMarkdown, IconCheck, IconChevronDown, IconChevronLeft, IconChevronRight, IconCopy, IconExternal, IconMessage, } from "#geistdocs-assets/icons";
6
+ import { LogoIconV0 } from "#geistdocs-assets/logos";
7
+ import { cn } from "#geistdocs-ui/utils";
8
+ import { useGeistdocsChatContext } from "./chat/context";
9
+ import { getPageActionOptions, } from "./page-action-options";
10
+ import { getMarkdown, getPageQuery } from "./page-markdown";
11
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, } from "./ui/dropdown-menu";
12
+ import { useIsMobile } from "./use-mobile";
13
+ const openInProviders = [
14
+ {
15
+ id: "v0",
16
+ label: "Open in v0",
17
+ getHref: (query) => `https://v0.app?${new URLSearchParams({ q: query }).toString()}`,
18
+ },
19
+ {
20
+ id: "chatgpt",
21
+ label: "Open in ChatGPT",
22
+ getHref: (query) => `https://chatgpt.com/?${new URLSearchParams({ hints: "search", prompt: query }).toString()}`,
23
+ },
24
+ {
25
+ id: "claude",
26
+ label: "Open in Claude",
27
+ getHref: (query) => `https://claude.ai/new?${new URLSearchParams({ q: query }).toString()}`,
28
+ },
29
+ {
30
+ id: "cursor",
31
+ label: "Open in Cursor",
32
+ getHref: (query) => {
33
+ const url = new URL("https://cursor.com/link/prompt");
34
+ url.searchParams.set("text", query);
35
+ return url.toString();
36
+ },
37
+ },
38
+ ];
39
+ const PageActionMenuItemContent = ({ description, icon, title, }) => (_jsxs("span", { className: "grid w-full grid-cols-[20px_minmax(0,1fr)] items-center gap-3 text-left", children: [_jsx("span", { className: "flex size-5 items-center justify-center text-gray-900", children: icon }), _jsxs("span", { className: "flex min-w-0 flex-col items-start gap-0.5", children: [_jsx("span", { className: "text-gray-1000 text-label-14", children: title }), _jsx("span", { className: "text-copy-13 text-gray-900", children: description })] })] }));
40
+ const OpenInProviderItems = ({ providers, query, }) => providers.map((provider) => (_jsx(DropdownMenuItem, { asChild: true, children: _jsxs("a", { className: "flex items-center gap-2 text-label-14", href: provider.getHref(query), rel: "noopener noreferrer", target: "_blank", children: [_jsx("span", { className: "flex-1", translate: "no", children: provider.label }), _jsx(IconExternal, { className: "size-4 shrink-0" })] }) }, provider.id)));
41
+ const ProviderMenuView = ({ backRef, onBack, providers, query, }) => (_jsxs(_Fragment, { children: [_jsxs(DropdownMenuItem, { className: "text-label-14", onSelect: (event) => {
42
+ event.preventDefault();
43
+ onBack();
44
+ }, ref: backRef, children: [_jsx(IconChevronLeft, { className: "size-4" }), _jsx("span", { children: "Back to page actions" })] }), _jsx(DropdownMenuSeparator, {}), _jsx(OpenInProviderItems, { providers: providers, query: query })] }));
45
+ const PageActionsMainMenu = ({ askAIEnabled, copyEnabled, handleCopy, isMobile, onAskAI, onShowProviders, onViewMarkdown, openInChatEnabled, openInChatRef, otherProviders, query, v0Provider, }) => {
46
+ return (_jsxs(_Fragment, { children: [copyEnabled ? (_jsxs(_Fragment, { children: [_jsx(DropdownMenuItem, { asChild: true, className: "h-auto w-full p-2", children: _jsx("button", { onClick: handleCopy, type: "button", children: _jsx(PageActionMenuItemContent, { description: "Copy page as Markdown for LLMs", icon: _jsx(IconCopy, { className: "size-4" }), title: "Copy page" }) }) }), _jsx(DropdownMenuItem, { asChild: true, className: "h-auto w-full p-2", children: _jsx("button", { onClick: onViewMarkdown, type: "button", children: _jsx(PageActionMenuItemContent, { description: "Open this page as plain text", icon: _jsx(IconAcronymMarkdown, { "aria-hidden": "true", className: "size-4" }), title: "View as Markdown" }) }) })] })) : null, openInChatEnabled ? (_jsxs(_Fragment, { children: [_jsx(DropdownMenuItem, { asChild: true, className: "h-auto p-2", children: _jsx("a", { href: v0Provider.getHref(query), rel: "noopener noreferrer", target: "_blank", children: _jsx(PageActionMenuItemContent, { description: "Ask v0 to help apply this page", icon: _jsx(LogoIconV0, { "aria-hidden": "true", size: 16 }), title: v0Provider.label }) }) }), isMobile ? (_jsxs(DropdownMenuItem, { className: "h-auto p-2", onSelect: (event) => {
47
+ event.preventDefault();
48
+ onShowProviders();
49
+ }, ref: openInChatRef, children: [_jsx(PageActionMenuItemContent, { description: "Use this page in another AI chat", icon: _jsx(IconExternal, { className: "size-4" }), title: "Open in another chat" }), _jsx(IconChevronRight, { className: "size-4" })] })) : (_jsxs(DropdownMenuSub, { children: [_jsx(DropdownMenuSubTrigger, { className: "h-auto p-2", children: _jsx(PageActionMenuItemContent, { description: "Use this page in another AI chat", icon: _jsx(IconExternal, { className: "size-4" }), title: "Open in another chat" }) }), _jsx(DropdownMenuSubContent, { className: "w-52", sideOffset: 12, children: _jsx(OpenInProviderItems, { providers: otherProviders, query: query }) })] }))] })) : null, askAIEnabled ? (_jsx(DropdownMenuItem, { className: "h-auto p-2", onSelect: onAskAI, children: _jsx(PageActionMenuItemContent, { description: "Chat with this page as context", icon: _jsx(IconMessage, { className: "size-4" }), title: "Ask AI about this page" }) })) : null] }));
50
+ };
51
+ // The desktop action control: a compact copy button plus an actions dropdown,
52
+ // aligned beside the page title.
53
+ const DesktopPageActions = ({ askAIEnabled, checked, copyEnabled, isMobile, menuView, onAskAI, onCopy, onPrefetchMarkdown, onViewMarkdown, openInChatEnabled, openInChatRef, otherProviders, providersBackRef, query, setMenuView, v0Provider, }) => {
54
+ return (_jsxs("div", { className: "inline-flex shrink-0 overflow-hidden rounded-md border border-gray-400 bg-background-100", children: [copyEnabled ? (_jsx("button", { "aria-label": "Copy page", className: "inline-flex size-8 touch-manipulation items-center justify-center transition-colors hover:bg-gray-100 hover:text-gray-1000 focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-gray-600/50", onClick: onCopy, onFocus: onPrefetchMarkdown, onPointerEnter: onPrefetchMarkdown, title: "Copy page", type: "button", children: _jsxs("span", { className: "relative size-4", children: [_jsx(IconCopy, { className: cn("absolute inset-0 size-4 transition-[transform,opacity] duration-200", checked ? "scale-75 opacity-0" : "scale-100 opacity-100") }), _jsx(IconCheck, { className: cn("absolute inset-0 size-4 transition-[transform,opacity] duration-200", checked ? "scale-100 opacity-100" : "scale-75 opacity-0") })] }) })) : null, _jsxs(DropdownMenu, { onOpenChange: (open) => {
55
+ if (!open) {
56
+ setMenuView("main");
57
+ }
58
+ }, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs("button", { "aria-label": copyEnabled ? "Open page actions" : "Page actions", className: "inline-flex h-8 touch-manipulation items-center justify-center gap-1.5 border-gray-400 border-l px-2 transition-colors hover:text-gray-1000 focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-gray-600/50 data-[state=closed]:bg-transparent data-[state=open]:bg-gray-100 data-[state=closed]:hover:bg-gray-100", type: "button", children: [copyEnabled ? null : _jsx("span", { children: "Page actions" }), _jsx(IconChevronDown, { className: "size-4" })] }) }), _jsx(DropdownMenuContent, { align: "end", className: "w-80 max-w-[calc(100vw-1rem)]", sideOffset: 8, children: isMobile && menuView === "providers" ? (_jsx(ProviderMenuView, { backRef: providersBackRef, onBack: () => {
59
+ setMenuView("main");
60
+ requestAnimationFrame(() => openInChatRef.current?.focus());
61
+ }, providers: otherProviders, query: query })) : (_jsx(PageActionsMainMenu, { askAIEnabled: askAIEnabled, copyEnabled: copyEnabled, handleCopy: onCopy, isMobile: isMobile, onAskAI: onAskAI, onShowProviders: () => {
62
+ setMenuView("providers");
63
+ requestAnimationFrame(() => providersBackRef.current?.focus());
64
+ }, onViewMarkdown: onViewMarkdown, openInChatEnabled: openInChatEnabled, openInChatRef: openInChatRef, otherProviders: otherProviders, query: query, v0Provider: v0Provider })) })] })] }));
65
+ };
66
+ /**
67
+ * The opt-in desktop page actions (`pageActions.menu: true`): the Copy page
68
+ * button plus a dropdown with View as Markdown, Open in chat and Ask AI. Kept
69
+ * in its own module so sites that don't opt in never download the menu.
70
+ */
71
+ export const GeistdocsPageActionsMenu = ({ config, page, }) => {
72
+ const isMobile = useIsMobile();
73
+ const { enabled: chatEnabled, openWithPage, preloadChat, setIsOpen, setPrompt, } = useGeistdocsChatContext();
74
+ const [menuView, setMenuView] = useState("main");
75
+ const openInChatRef = useRef(null);
76
+ const providersBackRef = useRef(null);
77
+ const markdownUrl = page.markdownUrl;
78
+ const prefetchMarkdown = () => {
79
+ getMarkdown(markdownUrl).catch(() => undefined);
80
+ };
81
+ const [checked, handleCopy] = useCopyButton(async () => {
82
+ await navigator.clipboard.writeText(await getMarkdown(markdownUrl));
83
+ });
84
+ const handleViewMarkdown = () => {
85
+ window.open(markdownUrl, "_blank", "noopener");
86
+ };
87
+ const { askAIEnabled, copyEnabled, openInChatEnabled, showMenu } = getPageActionOptions(config, chatEnabled, "desktop");
88
+ if (!showMenu) {
89
+ return null;
90
+ }
91
+ const query = getPageQuery(page.url);
92
+ const v0Provider = openInProviders[0];
93
+ const otherProviders = openInProviders.slice(1);
94
+ const onAskAI = () => {
95
+ preloadChat();
96
+ if (page.attachToChat === false) {
97
+ setPrompt(getPageQuery(page.url, window.location.origin));
98
+ setIsOpen(true);
99
+ return;
100
+ }
101
+ openWithPage({ title: page.title, url: page.url });
102
+ };
103
+ const preloadChatOnIntent = askAIEnabled ? preloadChat : undefined;
104
+ return (_jsxs("div", { className: "mb-2 @max-[961px]:hidden self-end", onFocusCapture: preloadChatOnIntent, onPointerEnter: preloadChatOnIntent, children: [_jsx(DesktopPageActions, { askAIEnabled: askAIEnabled, checked: checked, copyEnabled: copyEnabled, 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 }), _jsx("span", { "aria-live": "polite", className: "sr-only", children: checked ? "Page copied" : "" })] }));
105
+ };
@@ -0,0 +1,3 @@
1
+ export declare const getMarkdown: (url: string) => Promise<string>;
2
+ export declare const getPageQuery: (href: string, origin?: string) => string;
3
+ //# sourceMappingURL=page-markdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-markdown.d.ts","sourceRoot":"","sources":["../../src/internal/page-markdown.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,KAAG,OAAO,CAAC,MAAM,CAqBvD,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,EAAE,SAAS,MAAM,WAuBzD,CAAC"}
@@ -0,0 +1,45 @@
1
+ // Shared by the page actions client components, so Copy page reuses one
2
+ // in-flight Markdown request per URL.
3
+ const markdownRequests = new Map();
4
+ export const getMarkdown = (url) => {
5
+ const cached = markdownRequests.get(url);
6
+ if (cached) {
7
+ return cached;
8
+ }
9
+ const request = fetch(url)
10
+ .then((response) => {
11
+ if (!response.ok) {
12
+ throw new Error(`Failed to fetch markdown from ${url}`);
13
+ }
14
+ return response.text();
15
+ })
16
+ .catch((error) => {
17
+ markdownRequests.delete(url);
18
+ throw error;
19
+ });
20
+ markdownRequests.set(url, request);
21
+ return request;
22
+ };
23
+ export const getPageQuery = (href, origin) => {
24
+ const protocol = process.env.NODE_ENV === "production" ? "https" : "http";
25
+ const productionHost = process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL;
26
+ let configuredBaseUrl;
27
+ if (productionHost) {
28
+ configuredBaseUrl =
29
+ productionHost.startsWith("http://") ||
30
+ productionHost.startsWith("https://")
31
+ ? productionHost
32
+ : `${protocol}://${productionHost}`;
33
+ }
34
+ const baseUrl = origin ?? configuredBaseUrl;
35
+ let url = href;
36
+ if (baseUrl) {
37
+ try {
38
+ url = new URL(href, baseUrl).toString();
39
+ }
40
+ catch {
41
+ // Keep the app-local href when the optional production URL is malformed.
42
+ }
43
+ }
44
+ return `Read this page, I want to ask questions about it. ${url}`;
45
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../src/internal/sidebar.tsx"],"names":[],"mappings":"AAOA,OAAO,EAEL,KAAK,SAAS,EAQf,MAAM,OAAO,CAAC;AAef,OAAO,EAAE,KAAK,oBAAoB,EAAuB,MAAM,YAAY,CAAC;AAw/B5E,eAAO,MAAM,gBAAgB,GAAI,6CAK9B;IACD,IAAI,CAAC,EAAE,oBAAoB,CAAC;IAC5B,2EAA2E;IAC3E,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,GAAG,CAAC,EAAE,SAAS,CAAC;CACjB,4CAkEA,CAAC"}
1
+ {"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../src/internal/sidebar.tsx"],"names":[],"mappings":"AAOA,OAAO,EAEL,KAAK,SAAS,EAQf,MAAM,OAAO,CAAC;AAef,OAAO,EAAE,KAAK,oBAAoB,EAAuB,MAAM,YAAY,CAAC;AA0/B5E,eAAO,MAAM,gBAAgB,GAAI,6CAK9B;IACD,IAAI,CAAC,EAAE,oBAAoB,CAAC;IAC5B,2EAA2E;IAC3E,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,GAAG,CAAC,EAAE,SAAS,CAAC;CACjB,4CAkEA,CAAC"}
@@ -349,7 +349,10 @@ const DesktopSidebar = ({ mode, ...props }) => {
349
349
  }
350
350
  return _jsx(DesktopSectionsSidebar, { ...props });
351
351
  };
352
- const MobileSidebar = ({ activeUrl, idScope, nodes, onOpenChange, open, top, }) => (_jsx(Sheet, { onOpenChange: onOpenChange, open: open, children: _jsxs(SheetContent, { className: cn("flex w-full flex-col gap-0 bg-background-200 p-0 sm:max-w-none",
352
+ const MobileSidebar = ({ activeUrl, idScope, nodes, onOpenChange, open, top, }) => (_jsx(Sheet, { onOpenChange: onOpenChange, open: open, children: _jsxs(SheetContent, { className: cn(
353
+ // Geistcn's SheetContent defaults to an inset, margined panel.
354
+ // Override that for the full-screen mobile sidebar.
355
+ "inset-0! m-0! flex w-screen! max-w-none! flex-col gap-0 rounded-none! bg-background-200 p-0",
353
356
  // A full-width slide with no fade, so the page never shows through.
354
357
  // `!` overrides the state-variant animation classes provider sheets set.
355
358
  "data-[state=closed]:fade-out-100! data-[state=open]:fade-in-100! data-[state=closed]:slide-out-to-left! data-[state=open]:slide-in-from-left! duration-300! ease-[cubic-bezier(0.32,0.72,0,1)]! motion-reduce:animate-none!"), "data-geistdocs-mobile-sidebar": true, noOverlay: true, side: "left", children: [_jsxs(SheetHeader, { className: "h-16 shrink-0 flex-row items-center justify-between gap-2 border-b px-4 py-0 text-left", children: [_jsx(SheetTitle, { className: "text-label-16", children: "Browse" }), _jsx(SheetDescription, { className: "sr-only", children: "Navigation for the documentation." }), _jsx(SheetClose, { "aria-label": "Close menu", className: "-mr-2 grid size-8 shrink-0 touch-manipulation place-items-center rounded-md text-gray-900 transition-colors hover:bg-gray-alpha-100 hover:text-gray-1000 focus-visible:shadow-[var(--ds-focus-ring)] focus-visible:outline-none active:bg-gray-alpha-300 motion-reduce:transition-none", children: _jsx(IconCross, { size: 16 }) })] }), _jsx(MouseDownNavigation, { children: _jsxs("nav", { "aria-label": "Documentation", className: "min-h-0 flex-1 overflow-y-auto overflow-x-hidden overscroll-contain px-2 py-3 text-gray-900", "data-geistdocs-sidebar-scroll": true, children: [_jsx("div", { className: "pb-4 [&>button]:w-full", children: _jsx(SearchButton, { onClick: () => onOpenChange(false) }) }), top ? _jsx("div", { className: "pb-4", children: top }) : null, _jsx(SidebarTree, { activeUrl: activeUrl, idScope: idScope, nodes: nodes, onNavigate: () => onOpenChange(false), scrollActive: true, visible: open })] }) })] }) }));
@@ -2,8 +2,10 @@ import { type ReactNode } from "react";
2
2
  import type { GeistdocsConfig } from "../config";
3
3
  interface GeistdocsTableOfContentsActionsProps {
4
4
  config: Pick<GeistdocsConfig, "feedback" | "pageActions" | "siteId">;
5
+ /** Resolved "Edit this page on GitHub" URL; omit to hide the action. */
6
+ editSourceUrl?: string;
5
7
  extraActions: ReactNode[];
6
8
  }
7
- export declare const GeistdocsTableOfContentsActions: ({ config, extraActions, }: GeistdocsTableOfContentsActionsProps) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const GeistdocsTableOfContentsActions: ({ config, editSourceUrl, extraActions, }: GeistdocsTableOfContentsActionsProps) => import("react/jsx-runtime").JSX.Element;
8
10
  export {};
9
11
  //# sourceMappingURL=toc-actions-client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toc-actions-client.d.ts","sourceRoot":"","sources":["../../src/internal/toc-actions-client.tsx"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAQf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAKjD,UAAU,oCAAoC;IAC5C,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,aAAa,GAAG,QAAQ,CAAC,CAAC;IACrE,YAAY,EAAE,SAAS,EAAE,CAAC;CAC3B;AAwKD,eAAO,MAAM,+BAA+B,GAAI,2BAG7C,oCAAoC,4CAiBtC,CAAC"}
1
+ {"version":3,"file":"toc-actions-client.d.ts","sourceRoot":"","sources":["../../src/internal/toc-actions-client.tsx"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAKjD,UAAU,oCAAoC;IAC5C,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,aAAa,GAAG,QAAQ,CAAC,CAAC;IACrE,wEAAwE;IACxE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,SAAS,EAAE,CAAC;CAC3B;AAoKD,eAAO,MAAM,+BAA+B,GAAI,0CAI7C,oCAAoC,4CAiBtC,CAAC"}
@@ -2,7 +2,8 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { usePathname } from "next/navigation";
4
4
  import { useEffect, useState, useTransition, } from "react";
5
- import { IconAcronymMarkdown, IconArrowCircleUp, IconThumbUp, } from "#geistdocs-assets/icons";
5
+ import { IconAcronymMarkdown, IconThumbUp } from "#geistdocs-assets/icons";
6
+ import { LogoIconGithub } from "#geistdocs-assets/logos";
6
7
  import { Button } from "#geistdocs-ui/components/button";
7
8
  import { Textarea } from "#geistdocs-ui/components/textarea";
8
9
  import { sendFeedback } from "./feedback-action";
@@ -15,10 +16,7 @@ const feedbackEmotions = [
15
16
  { name: "happy", emoji: "🙂" },
16
17
  { name: "amazed", emoji: "🤩" },
17
18
  ];
18
- const ScrollTopAction = () => (_jsxs("button", { className: actionClassName, onClick: () => {
19
- const reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
20
- window.scrollTo({ top: 0, behavior: reduceMotion ? "auto" : "smooth" });
21
- }, type: "button", children: [_jsx(IconArrowCircleUp, { className: "size-3.5" }), _jsx("span", { children: "Scroll to top" })] }));
19
+ const EditSourceAction = ({ href }) => (_jsxs("a", { className: actionClassName, href: href, rel: "noopener noreferrer", target: "_blank", children: [_jsx(LogoIconGithub, { "aria-hidden": "true", className: "size-3.5" }), _jsx("span", { children: "Edit this page on GitHub" })] }));
22
20
  const FeedbackAction = ({ siteId }) => {
23
21
  const isMobile = useIsMobile();
24
22
  const url = usePathname();
@@ -66,13 +64,13 @@ const FeedbackAction = ({ siteId }) => {
66
64
  ? "bg-gray-100 text-gray-1000"
67
65
  : "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" })] })] })) }) })] }));
68
66
  };
69
- export const GeistdocsTableOfContentsActions = ({ config, extraActions, }) => {
67
+ export const GeistdocsTableOfContentsActions = ({ config, editSourceUrl, extraActions, }) => {
70
68
  const actions = [];
71
- if (config.pageActions?.scrollTop !== false) {
72
- actions.push(_jsx(ScrollTopAction, {}, "scroll-top"));
73
- }
74
69
  if (config.feedback?.enabled !== false) {
75
70
  actions.push(_jsx(FeedbackAction, { siteId: config.siteId }, "feedback"));
76
71
  }
72
+ if (editSourceUrl) {
73
+ actions.push(_jsx(EditSourceAction, { href: editSourceUrl }, "edit-source"));
74
+ }
77
75
  return (_jsxs(_Fragment, { children: [actions, extraActions] }));
78
76
  };
package/dist/mdx.js CHANGED
@@ -14,8 +14,9 @@ import { Step, Steps } from "./components/steps";
14
14
  import { Table } from "./components/table";
15
15
  import { TypeTable } from "./components/type-table";
16
16
  import { Video } from "./components/video";
17
- import { CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, CompactCodeBlockTabs, CopyPrompt, Mermaid, TabContent, Tabs, TabsWithChildren, } from "./internal/lazy-mdx-components";
17
+ import { CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, CompactCodeBlockTabs, CopyPrompt, TabContent, Tabs, TabsWithChildren, } from "./internal/lazy-mdx-components";
18
18
  import { LocalizedLink } from "./internal/localized-link";
19
+ import { MermaidSource } from "./internal/mermaid-source";
19
20
  import { geistShikiTheme as shikiTheme } from "./shiki-theme";
20
21
  // The source-config exports live on @vercel/geistdocs/source-config. Importing
21
22
  // them here would pull fumadocs-mdx/config, and through it Shiki with every
@@ -60,8 +61,8 @@ export const getGeistdocsMDXComponents = (components) => ({
60
61
  CopyPrompt,
61
62
  Details,
62
63
  Summary,
64
+ Mermaid: MermaidSource,
63
65
  Image,
64
- Mermaid,
65
66
  Steps,
66
67
  Step,
67
68
  Tabs,
@@ -79,6 +79,11 @@ export interface CreateDocsPageOptions<Params extends DocsPageParams = DocsPageP
79
79
  pageUrl: string;
80
80
  publicPageUrl: string;
81
81
  }) => ReactNode;
82
+ /**
83
+ * Generate Markdown for renderTop. Defaults to true. When false, renderTop
84
+ * receives an empty string unless pageActions.getExtraActions needs Markdown.
85
+ */
86
+ renderTopMarkdown?: boolean;
82
87
  resolveLink?: (context: {
83
88
  link: DocsPageLink;
84
89
  nativeLink: typeof NativeDocsLink;
@@ -89,7 +94,7 @@ export interface CreateDocsPageOptions<Params extends DocsPageParams = DocsPageP
89
94
  tableOfContent?: TableOfContentOptions;
90
95
  tableOfContentPopover?: ComponentProps<typeof FumadocsDocsPage>["tableOfContentPopover"];
91
96
  }
92
- export declare const createDocsPage: <Params extends DocsPageParams = DocsPageParams>({ canViewPage, config, source, mdx, pageActions, filterStaticParams, getMarkdownUrl, getPageUrl, getPublicPageUrl, metadata, openGraph, renderTop, resolveLink, tableOfContent, tableOfContentPopover, }: CreateDocsPageOptions<Params>) => {
97
+ export declare const createDocsPage: <Params extends DocsPageParams = DocsPageParams>({ canViewPage, config, source, mdx, pageActions, filterStaticParams, getMarkdownUrl, getPageUrl, getPublicPageUrl, metadata, openGraph, renderTop, renderTopMarkdown, resolveLink, tableOfContent, tableOfContentPopover, }: CreateDocsPageOptions<Params>) => {
93
98
  Page: ({ params }: {
94
99
  params: Promise<Params>;
95
100
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/pages/docs.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,QAAQ,IAAI,gBAAgB,EAE7B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAErC,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,aAAa,EAElB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,KAAK,eAAe,EAA+B,MAAM,WAAW,CAAC;AAgB9E,OAAO,EACL,KAAK,2BAA2B,EAEjC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEvD,KAAK,YAAY,GAAG,qBAAqB,CAAC;AAC1C,KAAK,aAAa,GAAG,WAAW,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAChF,KAAK,iBAAiB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC9D,KAAK,YAAY,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;AACvC,KAAK,qBAAqB,GAAG,WAAW,CACtC,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAC,gBAAgB,CAAC,CAC1D,CAAC;AACF,MAAM,WAAW,c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AM,CAAC;QAChB,aAAa,EAAE,MAAM,CAAC;KACvB,KAAK,SAAS,CAAC;IAChB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,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;AAoDD,eAAO,MAAM,cAAc,GAAI,MAAM,SAAS,cAAc,GAAG,cAAc,EAAE,6NAiB5E,qBAAqB,CAAC,MAAM,CAAC;uBAsPJ;QAAE,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;KAAE;0BA7KlB,MAAM;;;;oCA8LtC;QACD,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;KACzB,KAAG,OAAO,CAAC,QAAQ,CAAC;CAqDtB,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;CAA4B,CAAC"}
@@ -12,6 +12,7 @@ import { resolveDocumentTitle } from "../internal/document-title";
12
12
  import { omitLanguageParam, resolveRouteLanguage } from "../internal/languages";
13
13
  import { resolveLinkHref, stripBasePathFromHref } from "../internal/link-href";
14
14
  import { resolvePageMarkdownUrl as resolveInternalPageMarkdownUrl } from "../internal/markdown-url.js";
15
+ import { getEditSourceAction } from "../internal/page-action-options";
15
16
  import { createPageActions as createInternalPageActions } from "../internal/page-actions";
16
17
  import { GeistdocsPageActions } from "../internal/page-actions-gate";
17
18
  import { PageBreadcrumb } from "../internal/page-breadcrumb";
@@ -43,13 +44,13 @@ const DocsTitle = ({ className, ...props }) => (_jsx(FumadocsDocsTitle, { classN
43
44
  const DocsBody = ({ className, ...props }) => (_jsx(FumadocsDocsBody, { className: cn("mx-auto w-full", className), "data-geistdocs-article": "body", ...props }));
44
45
  /** App-provided footer content below the table-of-contents actions. */
45
46
  const TocFooterSlot = ({ children }) => children ? _jsx("div", { className: "mt-4", children: children }) : null;
46
- const hasTableOfContentsActions = (config, extraActions) => config.pageActions?.scrollTop !== false ||
47
- config.feedback?.enabled !== false ||
47
+ const hasTableOfContentsActions = (config, extraActions, editSourceUrl) => config.feedback?.enabled !== false ||
48
+ Boolean(editSourceUrl) ||
48
49
  extraActions.length > 0;
49
50
  const serializeParams = (params) => JSON.stringify(Object.entries(params)
50
51
  .filter(([, value]) => value !== undefined)
51
52
  .sort(([left], [right]) => left.localeCompare(right)));
52
- export const createDocsPage = ({ canViewPage, config, source, mdx, pageActions = createInternalPageActions({ config }), filterStaticParams, getMarkdownUrl, getPageUrl, getPublicPageUrl, metadata, openGraph, renderTop, resolveLink, tableOfContent, tableOfContentPopover, }) => {
53
+ export const createDocsPage = ({ canViewPage, config, source, mdx, pageActions = createInternalPageActions({ config }), filterStaticParams, getMarkdownUrl, getPageUrl, getPublicPageUrl, metadata, openGraph, renderTop, renderTopMarkdown = true, resolveLink, tableOfContent, tableOfContentPopover, }) => {
53
54
  const DocsLink = renderPrefetchedDocsLink.bind(null, config.siteUrl, config.basePath);
54
55
  const resolvePageUrls = (page, params) => {
55
56
  const pageUrl = getPageUrl?.({ page, params }) ?? page.url;
@@ -142,7 +143,7 @@ export const createDocsPage = ({ canViewPage, config, source, mdx, pageActions =
142
143
  previous: resolveFooterItem(footerItems.previous),
143
144
  next: resolveFooterItem(footerItems.next),
144
145
  };
145
- const markdown = pageActions.getExtraActions || renderTop
146
+ const markdown = pageActions.getExtraActions || (renderTop && renderTopMarkdown)
146
147
  ? await source.getPageMarkdown(page)
147
148
  : undefined;
148
149
  const footerActions = markdown
@@ -154,11 +155,15 @@ export const createDocsPage = ({ canViewPage, config, source, mdx, pageActions =
154
155
  },
155
156
  }) ?? [])
156
157
  : [];
157
- const hasTocActions = hasTableOfContentsActions(pageActions.config, footerActions);
158
+ const editSourceUrl = getEditSourceAction({
159
+ config: pageActions.config,
160
+ path: page.path,
161
+ });
162
+ const hasTocActions = hasTableOfContentsActions(pageActions.config, footerActions, editSourceUrl);
158
163
  const hasTocLinks = Boolean(data.toc?.length);
159
164
  // Actions stay adjacent to the table of contents; the app-provided
160
165
  // footer (promos and other custom content) renders below them.
161
- const tocFooter = (_jsxs(_Fragment, { children: [hasTocLinks && hasTocActions ? (_jsx("div", { className: "mt-4 border-gray-alpha-400 border-t pt-4", children: _jsx("nav", { "aria-label": "Page actions", className: "flex min-w-0 flex-col gap-1", children: _jsx(GeistdocsTableOfContentsActions, { config: pageActions.config, extraActions: footerActions }) }) })) : null, _jsx(TocFooterSlot, { children: tableOfContent?.footer })] }));
166
+ const tocFooter = (_jsxs(_Fragment, { children: [hasTocLinks && hasTocActions ? (_jsx("div", { className: "mt-4 border-gray-alpha-400 border-t pt-4", children: _jsx("nav", { "aria-label": "Page actions", className: "flex min-w-0 flex-col gap-1", children: _jsx(GeistdocsTableOfContentsActions, { config: pageActions.config, editSourceUrl: editSourceUrl, extraActions: footerActions }) }) })) : null, _jsx(TocFooterSlot, { children: tableOfContent?.footer })] }));
162
167
  const tocComponent = tableOfContent?.component ?? (_jsx(GeistdocsTableOfContents, { footer: tocFooter, header: tableOfContent?.header, toc: data.toc ?? [] }));
163
168
  return (_jsxs(FumadocsDocsPage, { breadcrumb: {
164
169
  component: _jsx(PageBreadcrumb, { tree: pageTree, url: page.url }),
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.16.0 so agents can understand the installed package without web access.
3
+ These docs are bundled with `@vercel/geistdocs` 3.0.1-canary.85002c3 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
@@ -29,7 +29,7 @@ They are generated from `apps/template/content/docs` during the package build.
29
29
  - [Migrate to Geistdocs](pages/migration.md): Move an existing documentation site to @vercel/geistdocs while keeping local content, routing, middleware behavior, and AI-readable surfaces intact.
30
30
  - [Choose a Geistdocs package](pages/packages.md): Use the public package by default and the private package only where restricted Vercel npm dependencies are already available.
31
31
  - [Configuration](pages/configuration.md): Configure site metadata, navigation, AI features, page actions, translations, and local adapters.
32
- - [MDX Components](pages/syntax.md): MDX component and authoring reference covering tabs, text formatting, code blocks, line highlighting, and Mermaid diagrams.
32
+ - [MDX Components](pages/syntax.md): MDX component and authoring reference covering tabs, text formatting, code blocks, and line highlighting.
33
33
  - [Geistdocs Provider](pages/provider.md): The root provider component that wraps your application to handle toast notifications, search, and analytics.
34
34
  - [Versioned docs](pages/versioned-docs.md): Use createVersionedSources to configure stable, pre-release, or host-based documentation versions.
35
35
  - [Proxy and markdown routes](pages/proxy.md): Configure createProxy with generated route discovery, request hooks, markdown mappings, and a static Next.js matcher.
@@ -56,7 +56,6 @@ They are generated from `apps/template/content/docs` during the package build.
56
56
  - [Input](pages/components/input.md): Use Input for text entry in custom documentation and application interfaces.
57
57
  - [Internationalization](pages/internationalization.md): Serve documentation in multiple languages with automatic translation via the Geistdocs CLI and Fumadocs routing.
58
58
  - [llms.txt](pages/llms-txt.md): A single endpoint that returns all documentation as plain Markdown text following the llms.txt standard.
59
- - [Mermaid](pages/components/mermaid.md): Use Mermaid directly when diagram source is assembled outside an MDX Mermaid fence.
60
59
  - [Native Link](pages/components/link.md): Use NativeDocsLink where Next.js client navigation is not appropriate.
61
60
  - [Navigation Menu](pages/components/navigation-menu.md): Compose NavigationMenu primitives for custom product and documentation navigation.
62
61
  - [Open in Chat](pages/open-in-chat.md): Transfer documentation context to AI chat platforms like ChatGPT, Claude, Cursor, and v0 with a single click.