@vercel/geistdocs 2.15.3-canary.f771302 → 2.15.4-canary.0faac50

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 (49) hide show
  1. package/dist/cli/index.js +1 -1
  2. package/dist/internal/mdx-to-markdown.d.ts.map +1 -1
  3. package/dist/internal/mdx-to-markdown.js +0 -9
  4. package/dist/internal/page-actions-client.js +1 -1
  5. package/dist/internal/page-actions.d.ts +4 -4
  6. package/dist/internal/page-actions.d.ts.map +1 -1
  7. package/dist/internal/page-actions.js +1 -6
  8. package/dist/mdx.d.ts +25 -3
  9. package/dist/mdx.d.ts.map +1 -1
  10. package/dist/mdx.js +61 -8
  11. package/dist/mobile-docs-bar.js +1 -1
  12. package/dist/next.d.ts +1 -9
  13. package/dist/next.d.ts.map +1 -1
  14. package/dist/next.js +2 -25
  15. package/dist/pages/docs.d.ts +98 -5
  16. package/dist/pages/docs.d.ts.map +1 -1
  17. package/dist/pages/docs.js +250 -13
  18. package/dist/source-config.d.ts +1 -10
  19. package/dist/source-config.d.ts.map +1 -1
  20. package/dist/source-config.js +10 -20
  21. package/docs/agents.md +1 -1
  22. package/docs/llms.txt +7 -3
  23. package/docs/manifest.json +1 -1
  24. package/docs/pages/configuration.md +6 -2
  25. package/package.json +7 -20
  26. package/rehype-code-highlights.d.ts +1 -1
  27. package/rehype-code-highlights.js +49 -1
  28. package/shared-theme.css +7 -1
  29. package/source-config-public.d.ts +15 -0
  30. package/source-config-public.js +44 -0
  31. package/source-config.js +10 -24
  32. package/template/content/docs/configuration.mdx +6 -2
  33. package/template/package.json +1 -1
  34. package/dist/mdx-basic.d.ts +0 -27
  35. package/dist/mdx-basic.d.ts.map +0 -1
  36. package/dist/mdx-basic.js +0 -61
  37. package/dist/pages/docs-custom.d.ts +0 -111
  38. package/dist/pages/docs-custom.d.ts.map +0 -1
  39. package/dist/pages/docs-custom.js +0 -250
  40. package/native-mdx/LICENSE-mdxjs-rs +0 -22
  41. package/native-mdx/binaries/darwin-arm64.node +0 -0
  42. package/native-mdx/binaries/linux-x64-gnu.node +0 -0
  43. package/native-mdx/data-entry.d.mts +0 -15
  44. package/native-mdx/data-entry.mjs +0 -116
  45. package/native-mdx/data-projection.mjs +0 -205
  46. package/native-mdx/loader-data.cjs +0 -36
  47. package/native-mdx/loader-mdx.cjs +0 -9
  48. package/native-mdx/loader-mdx.mjs +0 -235
  49. package/native-mdx/native-binding.cjs +0 -25
@@ -1,14 +1,251 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import Link from "fumadocs-core/link";
3
+ import { DocsBody as FumadocsDocsBody, DocsPage as FumadocsDocsPage, DocsTitle as FumadocsDocsTitle, } from "fumadocs-ui/layouts/docs/page";
4
+ import { notFound } from "next/navigation";
5
+ import { cache, } from "react";
6
+ import { cn } from "#geistdocs-ui/utils";
7
+ import { NativeDocsLink } from "../components/link";
8
+ import { getPublicPath, withBasePath } from "../config";
9
+ import { getDocsLinkClassName } from "../internal/docs-link-class-name";
10
+ import { DocsPageErrorBoundary } from "../internal/docs-page-error-boundary";
11
+ import { resolveDocumentTitle } from "../internal/document-title";
12
+ import { omitLanguageParam, resolveRouteLanguage } from "../internal/languages";
13
+ import { resolveLinkHref, stripBasePathFromHref } from "../internal/link-href";
14
+ import { resolvePageMarkdownUrl as resolveInternalPageMarkdownUrl } from "../internal/markdown-url.js";
15
+ import { createPageActions as createInternalPageActions } from "../internal/page-actions";
16
+ import { GeistdocsPageActions } from "../internal/page-actions-gate";
17
+ import { PageBreadcrumb } from "../internal/page-breadcrumb";
18
+ import { getPageFooterItems, PageFooter } from "../internal/page-footer";
19
+ import { filterPageTree } from "../internal/page-tree-visibility";
20
+ import { createRelativeDocsLink } from "../internal/relative-docs-link";
21
+ import { GeistdocsTableOfContents } from "../internal/table-of-contents";
22
+ import { GeistdocsTableOfContentsActions } from "../internal/toc-actions-client";
1
23
  import { createMdxComponents } from "../mdx";
2
- import { createDocsPage as createCustomDocsPage, } from "./docs-custom";
3
- // biome-ignore lint/performance/noBarrelFile: Keep the existing public API while the custom entry avoids the default registry.
4
- export { createPageActions, resolvePageMarkdownUrl, } from "./docs-custom";
5
- /** The default factory keeps the complete Geistdocs MDX component registry. */
6
- export const createDocsPage = (options) => createCustomDocsPage({
7
- ...options,
8
- mdx: (context) => ({
9
- ...createMdxComponents({ a: context.link }),
10
- ...(typeof options.mdx === "function"
11
- ? options.mdx(context)
12
- : options.mdx),
13
- }),
14
- });
24
+ import { getPageRobots, } from "../page-visibility";
25
+ const renderPrefetchedDocsLink = (siteUrl, basePath, { children, className, href, rel, target, ...props }) => {
26
+ const originalHref = String(href ?? "");
27
+ const resolved = resolveLinkHref(originalHref, siteUrl);
28
+ const linkHref = resolved.href === originalHref
29
+ ? resolved.href
30
+ : stripBasePathFromHref(resolved.href, basePath);
31
+ return (_jsx(Link, { ...props, className: getDocsLinkClassName(className), href: linkHref, prefetch: !resolved.external, rel: resolved.external ? rel : undefined, target: resolved.external ? target : undefined, children: children }));
32
+ };
33
+ export const resolvePageMarkdownUrl = (options) => resolveInternalPageMarkdownUrl(options);
34
+ /**
35
+ * The page's visible article parts carry `data-geistdocs-article` (`title`,
36
+ * `body`) so tools that read the rendered HTML (docs
37
+ * crawlers, parity checks against the Markdown route) can select the
38
+ * article without depending on Fumadocs' element ids or on class names.
39
+ * The marked elements hold content only: page actions, breadcrumbs, the
40
+ * table of contents, and the previous/next footer sit outside them.
41
+ */
42
+ const DocsTitle = ({ className, ...props }) => (_jsx(FumadocsDocsTitle, { className: cn("mb-4 text-balance", className), "data-geistdocs-article": "title", ...props }));
43
+ const DocsBody = ({ className, ...props }) => (_jsx(FumadocsDocsBody, { className: cn("mx-auto w-full", className), "data-geistdocs-article": "body", ...props }));
44
+ /** App-provided footer content below the table-of-contents actions. */
45
+ 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 ||
48
+ extraActions.length > 0;
49
+ const serializeParams = (params) => JSON.stringify(Object.entries(params)
50
+ .filter(([, value]) => value !== undefined)
51
+ .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
+ const DocsLink = renderPrefetchedDocsLink.bind(null, config.siteUrl, config.basePath);
54
+ const resolvePageUrls = (page, params) => {
55
+ const pageUrl = getPageUrl?.({ page, params }) ?? page.url;
56
+ const publicPageUrl = getPublicPageUrl?.({ page, params, pageUrl }) ??
57
+ getPublicPath(pageUrl, config.basePath);
58
+ const markdownUrl = getMarkdownUrl?.({ page, params, pageUrl, publicPageUrl }) ??
59
+ resolveInternalPageMarkdownUrl({
60
+ basePath: config.basePath,
61
+ isRootMountedPage: source.baseUrl === "/" && page.slugs.length === 0,
62
+ pageUrl,
63
+ publicPageUrl,
64
+ });
65
+ return { markdownUrl, pageUrl, publicPageUrl };
66
+ };
67
+ const getAccessState = cache(async (paramsKey) => {
68
+ const params = Object.fromEntries(JSON.parse(paramsKey));
69
+ const tree = source.source.getPageTree(params.lang);
70
+ if (!canViewPage) {
71
+ return { tree, visibleUrls: undefined };
72
+ }
73
+ const access = await Promise.all(source.source.getPages(params.lang).map(async (page) => ({
74
+ page,
75
+ visible: await canViewPage(page, { params, source }),
76
+ })));
77
+ const visibleUrls = new Set(access.filter(({ visible }) => visible).map(({ page }) => page.url));
78
+ const hiddenUrls = new Set(access.filter(({ visible }) => !visible).map(({ page }) => page.url));
79
+ return { tree: filterPageTree(tree, hiddenUrls), visibleUrls };
80
+ });
81
+ // Single-language apps have no [lang] segment, so params arrive without it.
82
+ const resolveParams = async (params) => {
83
+ const resolved = await params;
84
+ return {
85
+ ...resolved,
86
+ lang: resolveRouteLanguage(config, resolved.lang),
87
+ };
88
+ };
89
+ const getPage = async (params) => {
90
+ const page = source.source.getPage(params.slug, params.lang);
91
+ if (!page) {
92
+ notFound();
93
+ }
94
+ if (canViewPage) {
95
+ const { visibleUrls } = await getAccessState(serializeParams(params));
96
+ if (!visibleUrls?.has(page.url)) {
97
+ notFound();
98
+ }
99
+ }
100
+ return page;
101
+ };
102
+ const getPageTree = async (params) => (await getAccessState(serializeParams(params))).tree;
103
+ const PageContent = async ({ params }) => {
104
+ const resolvedParams = await resolveParams(params);
105
+ const { lang } = resolvedParams;
106
+ const page = await getPage(resolvedParams);
107
+ const pageTree = await getPageTree(resolvedParams);
108
+ const data = page.data;
109
+ const MDX = data.body;
110
+ const defaultLink = createRelativeDocsLink(source.source, page, DocsLink);
111
+ const link = resolveLink
112
+ ? resolveLink({
113
+ link: defaultLink,
114
+ nativeLink: NativeDocsLink,
115
+ page,
116
+ source,
117
+ })
118
+ : defaultLink;
119
+ const resolvedMdx = typeof mdx === "function" ? mdx({ link, page, source }) : mdx;
120
+ const { markdownUrl, pageUrl, publicPageUrl } = resolvePageUrls(page, resolvedParams);
121
+ const footerItems = getPageFooterItems(pageTree, page.url);
122
+ const pagesByUrl = getPageUrl
123
+ ? new Map(source.source.getPages(lang).map((entry) => [entry.url, entry]))
124
+ : undefined;
125
+ const resolveFooterItem = (item) => {
126
+ if (!(item && getPageUrl && pagesByUrl)) {
127
+ return item;
128
+ }
129
+ const itemPage = pagesByUrl.get(item.url);
130
+ if (!itemPage) {
131
+ return item;
132
+ }
133
+ return {
134
+ ...item,
135
+ url: getPageUrl({
136
+ page: itemPage,
137
+ params: { ...resolvedParams, slug: itemPage.slugs },
138
+ }),
139
+ };
140
+ };
141
+ const resolvedFooterItems = {
142
+ previous: resolveFooterItem(footerItems.previous),
143
+ next: resolveFooterItem(footerItems.next),
144
+ };
145
+ const markdown = pageActions.getExtraActions || renderTop
146
+ ? await source.getPageMarkdown(page)
147
+ : undefined;
148
+ const footerActions = markdown
149
+ ? (pageActions.getExtraActions?.({
150
+ markdown,
151
+ page: {
152
+ path: page.path,
153
+ url: publicPageUrl,
154
+ },
155
+ }) ?? [])
156
+ : [];
157
+ const hasTocActions = hasTableOfContentsActions(pageActions.config, footerActions);
158
+ const hasTocLinks = Boolean(data.toc?.length);
159
+ // Actions stay adjacent to the table of contents; the app-provided
160
+ // 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 })] }));
162
+ const tocComponent = tableOfContent?.component ?? (_jsx(GeistdocsTableOfContents, { footer: tocFooter, header: tableOfContent?.header, toc: data.toc ?? [] }));
163
+ return (_jsxs(FumadocsDocsPage, { breadcrumb: {
164
+ component: _jsx(PageBreadcrumb, { tree: pageTree, url: page.url }),
165
+ }, footer: { component: _jsx(PageFooter, { ...resolvedFooterItems }) }, full: data.full, tableOfContent: {
166
+ enabled: true,
167
+ single: true,
168
+ ...tableOfContent,
169
+ component: tocComponent,
170
+ }, tableOfContentPopover: {
171
+ enabled: false,
172
+ ...tableOfContentPopover,
173
+ }, toc: data.toc, children: [renderTop?.({
174
+ data,
175
+ markdown: markdown ?? "",
176
+ markdownUrl,
177
+ page,
178
+ pageUrl,
179
+ publicPageUrl,
180
+ }), _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: {
181
+ markdownUrl,
182
+ path: page.path,
183
+ title: data.title,
184
+ url: publicPageUrl,
185
+ } })] }), _jsx("div", { className: "-mt-6 mb-4 @min-[961px]:hidden", children: _jsx(GeistdocsPageActions, { config: pageActions.config, only: "mobile", page: {
186
+ markdownUrl,
187
+ path: page.path,
188
+ title: data.title,
189
+ url: publicPageUrl,
190
+ } }) }), _jsx(DocsBody, { children: _jsx(MDX, { components: {
191
+ ...createMdxComponents({ a: link }),
192
+ ...resolvedMdx,
193
+ } }) })] }));
194
+ };
195
+ const Page = ({ params }) => (_jsx(DocsPageErrorBoundary, { children: _jsx(PageContent, { params: params }) }));
196
+ const generateStaticParams = () => {
197
+ const params = source.source.generateParams();
198
+ const filtered = filterStaticParams
199
+ ? params.filter(filterStaticParams)
200
+ : params;
201
+ return omitLanguageParam(config, filtered);
202
+ };
203
+ const generateMetadata = async ({ params, }) => {
204
+ const resolvedParams = await resolveParams(params);
205
+ const page = await getPage(resolvedParams);
206
+ const pageTree = await getPageTree(resolvedParams);
207
+ const data = page.data;
208
+ const { markdownUrl, publicPageUrl } = resolvePageUrls(page, resolvedParams);
209
+ const openGraphImages = openGraph?.images === true
210
+ ? source.getPageImage(page).url
211
+ : openGraph?.images;
212
+ let canonicalUrl;
213
+ if (data.canonical) {
214
+ canonicalUrl = withBasePath(data.canonical, config.basePath);
215
+ }
216
+ else if (config.siteUrl) {
217
+ canonicalUrl = new URL(publicPageUrl, config.siteUrl).toString();
218
+ }
219
+ const defaultMetadata = {
220
+ title: resolveDocumentTitle({
221
+ pageTitle: data.title,
222
+ pageUrl: page.url,
223
+ tree: pageTree,
224
+ }),
225
+ description: data.description,
226
+ keywords: data.keywords,
227
+ robots: getPageRobots(page),
228
+ ...(openGraphImages ? { openGraph: { images: openGraphImages } } : {}),
229
+ alternates: {
230
+ canonical: canonicalUrl,
231
+ types: {
232
+ "text/markdown": markdownUrl,
233
+ },
234
+ },
235
+ };
236
+ return metadata
237
+ ? await metadata({
238
+ metadata: defaultMetadata,
239
+ page,
240
+ params: resolvedParams,
241
+ })
242
+ : defaultMetadata;
243
+ };
244
+ return {
245
+ Page,
246
+ getPageTree,
247
+ generateStaticParams,
248
+ generateMetadata,
249
+ };
250
+ };
251
+ export const createPageActions = createInternalPageActions;
@@ -3,15 +3,6 @@ import type { Pluggable } from "unified";
3
3
  import { z } from "zod";
4
4
  type FumadocsConfigInput = NonNullable<Parameters<typeof defineFumadocsConfig>[0]>;
5
5
  export interface GeistdocsSourceConfigOptions {
6
- /**
7
- * Code block highlighter. `highlights` tokenizes with @pierre/highlights'
8
- * Wasm lexers, keeping Shiki's HTML output and Fumadocs' code block
9
- * transformers. `shiki` uses Shiki's TextMate grammars, for languages
10
- * Highlights doesn't support or custom grammars.
11
- *
12
- * @defaultValue "highlights"
13
- */
14
- highlighter?: "shiki" | "highlights";
15
6
  mdxOptions?: DefaultMDXOptions;
16
7
  plugins?: FumadocsConfigInput["plugins"];
17
8
  }
@@ -90,7 +81,7 @@ export declare const geistdocsMetaSchema: z.ZodObject<{
90
81
  * Fumadocs, which places it among its defaults; a function receives those
91
82
  * defaults and returns the final list.
92
83
  */
93
- export declare const resolveGeistdocsRehypePlugins: (consumerPlugins: DefaultMDXOptions["rehypePlugins"], leadingPlugins?: Pluggable[]) => NonNullable<DefaultMDXOptions["rehypePlugins"]>;
84
+ export declare const resolveGeistdocsRehypePlugins: (consumerPlugins: DefaultMDXOptions["rehypePlugins"]) => NonNullable<DefaultMDXOptions["rehypePlugins"]>;
94
85
  export declare const defineGeistdocsSourceConfig: (config?: GeistdocsSourceConfigOptions) => import("fumadocs-mdx/config").GlobalConfig;
95
86
  export {};
96
87
  //# sourceMappingURL=source-config.d.ts.map
@@ -1 +1 @@
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;AAMxB,KAAK,mBAAmB,GAAG,WAAW,CACpC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAC3C,CAAC;AAEF,MAAM,WAAW,4BAA4B;IAC3C;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,YAAY,CAAC;IACrC,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,EAgBX,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;CAsG3B,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwCrC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;iBAAa,CAAC;AAE9C;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,GACxC,iBAAiB,iBAAiB,CAAC,eAAe,CAAC,EACnD,iBAAgB,SAAS,EAAO,KAC/B,WAAW,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAShD,CAAC;AAEF,eAAO,MAAM,2BAA2B,GACtC,SAAQ,4BAAiC,+CAiC1C,CAAC"}
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;AAKxB,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,EAgBX,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;CAsG3B,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwCrC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;iBAAa,CAAC;AAE9C;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,GACxC,iBAAiB,iBAAiB,CAAC,eAAe,CAAC,KAClD,WAAW,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAKhD,CAAC;AAEF,eAAO,MAAM,2BAA2B,GACtC,SAAQ,4BAAiC,+CA2B1C,CAAC"}
@@ -2,7 +2,6 @@ import { remarkHeading, remarkMdxMermaid, remarkSteps, remarkStructure, } from "
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
- import { rehypeCodeHighlights } from "../rehype-code-highlights.js";
6
5
  import { rehypeTaskListLabels } from "../rehype-task-list-labels.js";
7
6
  import { remarkDetails } from "../remark-details.js";
8
7
  import { getLastModified } from "./internal/last-modified.js";
@@ -170,37 +169,28 @@ export const geistdocsMetaSchema = metaSchema;
170
169
  * Fumadocs, which places it among its defaults; a function receives those
171
170
  * defaults and returns the final list.
172
171
  */
173
- export const resolveGeistdocsRehypePlugins = (consumerPlugins, leadingPlugins = []) => {
172
+ export const resolveGeistdocsRehypePlugins = (consumerPlugins) => {
174
173
  if (typeof consumerPlugins === "function") {
175
- return (defaults) => [
176
- ...leadingPlugins,
177
- ...consumerPlugins(defaults),
178
- rehypeTaskListLabels,
179
- ];
174
+ return (defaults) => [...consumerPlugins(defaults), rehypeTaskListLabels];
180
175
  }
181
- return [...leadingPlugins, ...(consumerPlugins ?? []), rehypeTaskListLabels];
176
+ return [...(consumerPlugins ?? []), rehypeTaskListLabels];
182
177
  };
183
178
  export const defineGeistdocsSourceConfig = (config = {}) => {
184
179
  const existingRemarkPlugins = Array.isArray(config.mdxOptions?.remarkPlugins)
185
180
  ? config.mdxOptions.remarkPlugins
186
181
  : [];
187
182
  const existingPlugins = Array.isArray(config.plugins) ? config.plugins : [];
188
- const { highlighter = "highlights", ...fumadocsConfig } = config;
189
- const rehypeCodeOptions = {
190
- ...config.mdxOptions?.rehypeCodeOptions,
191
- themes: { light: geistShikiTheme },
192
- defaultColor: "light",
193
- };
194
- // `highlights` swaps Shiki's tokenizer for @pierre/highlights; `shiki`
195
- // keeps Fumadocs' rehypeCode.
196
- const useHighlights = highlighter === "highlights";
197
183
  return defineFumadocsConfig({
198
- ...fumadocsConfig,
184
+ ...config,
199
185
  mdxOptions: {
200
186
  ...config.mdxOptions,
201
187
  remarkPlugins: (defaults) => resolveGeistdocsRemarkPlugins(defaults, existingRemarkPlugins),
202
- rehypePlugins: resolveGeistdocsRehypePlugins(config.mdxOptions?.rehypePlugins, useHighlights ? [[rehypeCodeHighlights, rehypeCodeOptions]] : []),
203
- rehypeCodeOptions: useHighlights ? false : rehypeCodeOptions,
188
+ rehypePlugins: resolveGeistdocsRehypePlugins(config.mdxOptions?.rehypePlugins),
189
+ rehypeCodeOptions: {
190
+ ...config.mdxOptions?.rehypeCodeOptions,
191
+ themes: { light: geistShikiTheme },
192
+ defaultColor: "light",
193
+ },
204
194
  },
205
195
  plugins: [
206
196
  lastModified({ versionControl: getLastModified }),
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.15.3-canary.f771302 so agents can understand the installed package without web access.
3
+ These docs are bundled with `@vercel/geistdocs` 2.15.4-canary.0faac50 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.15.3-canary.f771302.
3
+ These docs are bundled with `@vercel/geistdocs` 2.15.4-canary.0faac50.
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
@@ -1424,14 +1424,18 @@ export const docs = defineDocs({
1424
1424
  export default defineGeistdocsSourceConfig();
1425
1425
  ```
1426
1426
 
1427
- ### Code highlighter
1427
+ ### Code highlighter (public package)
1428
1428
 
1429
- Code blocks are tokenized by [Highlights](https://diffs.com/highlights), which uses hand-written WebAssembly lexers, and rendered with the same HTML as Shiki: Geist colors, titles, icons, tabs, and `[!code ...]` notation all work. Languages without a built-in Highlights lexer render as plain text. To use Shiki's TextMate grammars instead, for example for an unsupported language, pass `highlighter: "shiki"`:
1429
+ The public package uses [Highlights](https://diffs.com/highlights), which tokenizes code with WebAssembly lexers while keeping the JavaScript MDX compiler. Geist colors, titles, icons, tabs and `[!code ...]` annotations are preserved. Some token colors differ from Shiki, and unsupported languages render as plain text. To use Shiki's TextMate grammars instead, pass `highlighter: "shiki"`:
1430
1430
 
1431
1431
  ```ts title="source.config.ts"
1432
1432
  export default defineGeistdocsSourceConfig({ highlighter: "shiki" });
1433
1433
  ```
1434
1434
 
1435
+ Set `highlighter: false` or `mdxOptions.rehypeCodeOptions: false` to disable built-in highlighting when providing your own plugin. A `rehypePlugins` callback can also remove or replace Fumadocs' default highlighter without Highlights being added back.
1436
+
1437
+ The private package retains its existing Shiki pipeline. The `highlighter` option above is available only in the public package.
1438
+
1435
1439
  To serve docs from the site root, use `route: "/"` in `content` and `baseUrl: "/"` in `createSource`. Root-mounted docs need explicit `markdownRoutes`; Geistdocs does not infer a broad `/*path` mapping because it can capture homepages and non-docs app routes.
1436
1440
 
1437
1441
  ## Page URLs
@@ -467,5 +467,5 @@
467
467
  }
468
468
  ],
469
469
  "source": "apps/template/content/docs",
470
- "version": "2.15.3-canary.f771302"
470
+ "version": "2.15.4-canary.0faac50"
471
471
  }
@@ -285,14 +285,18 @@ export const docs = defineDocs({
285
285
  export default defineGeistdocsSourceConfig();
286
286
  ```
287
287
 
288
- ### Code highlighter
288
+ ### Code highlighter (public package)
289
289
 
290
- Code blocks are tokenized by [Highlights](https://diffs.com/highlights), which uses hand-written WebAssembly lexers, and rendered with the same HTML as Shiki: Geist colors, titles, icons, tabs, and `[!code ...]` notation all work. Languages without a built-in Highlights lexer render as plain text. To use Shiki's TextMate grammars instead, for example for an unsupported language, pass `highlighter: "shiki"`:
290
+ The public package uses [Highlights](https://diffs.com/highlights), which tokenizes code with WebAssembly lexers while keeping the JavaScript MDX compiler. Geist colors, titles, icons, tabs and `[!code ...]` annotations are preserved. Some token colors differ from Shiki, and unsupported languages render as plain text. To use Shiki's TextMate grammars instead, pass `highlighter: "shiki"`:
291
291
 
292
292
  ```ts title="source.config.ts"
293
293
  export default defineGeistdocsSourceConfig({ highlighter: "shiki" });
294
294
  ```
295
295
 
296
+ Set `highlighter: false` or `mdxOptions.rehypeCodeOptions: false` to disable built-in highlighting when providing your own plugin. A `rehypePlugins` callback can also remove or replace Fumadocs' default highlighter without Highlights being added back.
297
+
298
+ The private package retains its existing Shiki pipeline. The `highlighter` option above is available only in the public package.
299
+
296
300
  To serve docs from the site root, use `route: "/"` in `content` and `baseUrl: "/"` in `createSource`. Root-mounted docs need explicit `markdownRoutes`; Geistdocs does not infer a broad `/*path` mapping because it can capture homepages and non-docs app routes.
297
301
 
298
302
  ## Page URLs
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vercel/geistdocs",
3
3
  "description": "Runtime and CLI for Geistdocs projects.",
4
- "version": "2.15.3-canary.f771302",
4
+ "version": "2.15.4-canary.0faac50",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -34,13 +34,14 @@
34
34
  "remark-details.d.ts",
35
35
  "remark-details.js",
36
36
  "source-config.js",
37
+ "source-config-public.js",
38
+ "source-config-public.d.ts",
37
39
  "template",
38
40
  "public-foundation.css",
39
41
  "shared-theme.css",
40
42
  "styles.css",
41
43
  "theme.css",
42
- "LICENSE",
43
- "native-mdx"
44
+ "LICENSE"
44
45
  ],
45
46
  "exports": {
46
47
  "./changelog": {
@@ -164,8 +165,8 @@
164
165
  "default": "./dist/providers/public/utils.js"
165
166
  },
166
167
  "./source-config": {
167
- "types": "./dist/source-config.d.ts",
168
- "default": "./source-config.js"
168
+ "types": "./source-config-public.d.ts",
169
+ "default": "./source-config-public.js"
169
170
  },
170
171
  "./docs/agents.md": "./docs/agents.md",
171
172
  "./docs/llms.txt": "./docs/llms.txt",
@@ -302,21 +303,7 @@
302
303
  },
303
304
  "./styles.css": "./styles.css",
304
305
  "./theme.css": "./theme.css",
305
- "./package.json": "./package.json",
306
- "./pages/docs/custom": {
307
- "types": "./dist/pages/docs-custom.d.ts",
308
- "default": "./dist/pages/docs-custom.js"
309
- },
310
- "./mdx/basic": {
311
- "types": "./dist/mdx-basic.d.ts",
312
- "default": "./dist/mdx-basic.js"
313
- },
314
- "./native-mdx": "./native-mdx/loader-mdx.cjs",
315
- "./native-mdx/data-loader": "./native-mdx/loader-data.cjs",
316
- "./native-mdx/data-entry": {
317
- "types": "./native-mdx/data-entry.d.mts",
318
- "import": "./native-mdx/data-entry.mjs"
319
- }
306
+ "./package.json": "./package.json"
320
307
  },
321
308
  "scripts": {
322
309
  "build": "rm -rf dist docs template && node ./scripts/bundle-template.mjs && node ./scripts/bundle-docs.mjs && tsc -p tsconfig.runtime.json && tsup --config tsup.config.cli.ts",
@@ -5,7 +5,7 @@ import type { Root } from "hast";
5
5
  export declare const geistHighlightsTheme: Record<string, unknown>;
6
6
 
7
7
  /**
8
- * Experimental drop-in for Fumadocs' `rehypeCode` that tokenizes with
8
+ * Drop-in for Fumadocs' `rehypeCode` that tokenizes with
9
9
  * @pierre/highlights while keeping Shiki's HAST output and transformers.
10
10
  */
11
11
  export declare const rehypeCodeHighlights: (
@@ -7,7 +7,7 @@ import {
7
7
  } from "fumadocs-core/mdx-plugins";
8
8
  import { tokensToHast, transformerDecorations } from "shiki/core";
9
9
 
10
- // Experimental: highlights code blocks with @pierre/highlights (hand-written
10
+ // Highlights code blocks with @pierre/highlights (hand-written
11
11
  // Wasm lexers) instead of Shiki's TextMate grammars, while keeping Shiki's
12
12
  // HAST output and transformer pipeline so Fumadocs' code block features
13
13
  // (titles, icons, tabs, line notation, diffs, focus) keep working.
@@ -116,6 +116,53 @@ const getTransformers = (options) => [
116
116
  ];
117
117
 
118
118
  const UNSTYLED = "var(--shiki-foreground)";
119
+ const COMMENT = "var(--shiki-token-comment)";
120
+ const TRAILING_SPACE = /[\t ]+$/;
121
+
122
+ const joinCommentWhitespace = (line) => {
123
+ for (let index = 1; index < line.length; index++) {
124
+ const token = line[index];
125
+ if (token.htmlStyle?.color !== COMMENT) {
126
+ continue;
127
+ }
128
+ // Shiki groups JSX indentation with the opening brace. Its annotation
129
+ // transformer recognizes a standalone JSX comment by those three tokens.
130
+ const opening = index - 1;
131
+ if (
132
+ token.content.trimStart().startsWith("/*") &&
133
+ line[opening].content.trim() === "{" &&
134
+ line[index + 1]?.content.trim() === "}" &&
135
+ line.slice(0, opening).every((part) => part.content.trim() === "")
136
+ ) {
137
+ const indentation = line
138
+ .slice(0, opening)
139
+ .map((part) => part.content)
140
+ .join("");
141
+ line[opening].content = indentation + line[opening].content;
142
+ line[opening].offset -= indentation.length;
143
+ line.splice(0, opening);
144
+ index -= opening;
145
+ }
146
+ // Shiki includes the separator before a comment in its comment token.
147
+ // Match that boundary so notation removal also removes the separator,
148
+ // without trimming authored whitespace from unrelated code lines.
149
+ while (index > 0) {
150
+ const previous = line[index - 1];
151
+ const whitespace = previous.content.match(TRAILING_SPACE)?.[0];
152
+ if (!whitespace) {
153
+ break;
154
+ }
155
+ previous.content = previous.content.slice(0, -whitespace.length);
156
+ token.content = whitespace + token.content;
157
+ token.offset -= whitespace.length;
158
+ if (previous.content) {
159
+ break;
160
+ }
161
+ line.splice(index - 1, 1);
162
+ index--;
163
+ }
164
+ }
165
+ };
119
166
 
120
167
  const tokenize = (code, options) => {
121
168
  const result = codeToTokens(code, {
@@ -127,6 +174,7 @@ const tokenize = (code, options) => {
127
174
  // Highlights colors unstyled runs with `var(--shiki-foreground)`; Shiki uses
128
175
  // the theme foreground, which Geist defines as `--shiki-color-text`.
129
176
  for (const line of result.tokens) {
177
+ joinCommentWhitespace(line);
130
178
  for (const token of line) {
131
179
  if (token.htmlStyle?.color === UNSTYLED) {
132
180
  token.htmlStyle = { ...token.htmlStyle, color: result.fg };
package/shared-theme.css CHANGED
@@ -281,7 +281,13 @@ button:not(:disabled, [aria-disabled="true"]) {
281
281
  }
282
282
  }
283
283
 
284
- @container (max-width: 960px) {
284
+ @container (width < 961px) {
285
+ #nd-page {
286
+ max-width: none;
287
+ padding-inline: 1.5rem;
288
+ transform: none;
289
+ }
290
+
285
291
  #nd-page > .text-gray-900:first-child {
286
292
  display: none;
287
293
  }
@@ -0,0 +1,15 @@
1
+ import type {
2
+ GeistdocsSourceConfigOptions as BaseOptions,
3
+ defineGeistdocsSourceConfig as defineBaseConfig,
4
+ } from "./dist/source-config.js";
5
+
6
+ export * from "./dist/source-config.js";
7
+
8
+ export interface GeistdocsSourceConfigOptions extends BaseOptions {
9
+ /** Public package only. Defaults to Highlights; false disables highlighting. */
10
+ highlighter?: "highlights" | "shiki" | false;
11
+ }
12
+
13
+ export declare const defineGeistdocsSourceConfig: (
14
+ options?: GeistdocsSourceConfigOptions
15
+ ) => ReturnType<typeof defineBaseConfig>;
@@ -0,0 +1,44 @@
1
+ import { rehypeCode } from "fumadocs-core/mdx-plugins";
2
+ import { rehypeCodeHighlights } from "./rehype-code-highlights.js";
3
+ import { defineGeistdocsSourceConfig as defineBaseConfig } from "./source-config.js";
4
+
5
+ // biome-ignore lint/performance/noBarrelFile: this package entry point reuses the already-loaded source config.
6
+ export * from "./source-config.js";
7
+
8
+ // Keep the shared source config on Shiki: the private product copies that
9
+ // entry point and must not acquire a dependency on Highlights.
10
+ export const defineGeistdocsSourceConfig = (options = {}) => {
11
+ const { highlighter = "highlights", ...config } = options;
12
+ if (!["highlights", "shiki", false].includes(highlighter)) {
13
+ throw new TypeError(`Unknown code highlighter: ${highlighter}`);
14
+ }
15
+ const result = defineBaseConfig(config);
16
+ const mdx = result.mdxOptions;
17
+ if (highlighter === false || config.mdxOptions?.rehypeCodeOptions === false) {
18
+ mdx.rehypeCodeOptions = false;
19
+ return result;
20
+ }
21
+ if (highlighter === "shiki") {
22
+ return result;
23
+ }
24
+
25
+ const plugins = mdx.rehypePlugins;
26
+ if (typeof plugins === "function") {
27
+ // Let consumers remove or replace the default highlighter first. Only
28
+ // replace Shiki if their final pipeline still contains it.
29
+ mdx.rehypePlugins = (defaults) =>
30
+ plugins(defaults).map((entry) => {
31
+ const [plugin, pluginOptions] = Array.isArray(entry) ? entry : [entry];
32
+ return plugin === rehypeCode
33
+ ? [rehypeCodeHighlights, pluginOptions]
34
+ : entry;
35
+ });
36
+ } else {
37
+ mdx.rehypePlugins = [
38
+ [rehypeCodeHighlights, mdx.rehypeCodeOptions],
39
+ ...(plugins ?? []),
40
+ ];
41
+ mdx.rehypeCodeOptions = false;
42
+ }
43
+ return result;
44
+ };