@vercel/geistdocs 1.27.0 → 1.28.0
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/changelog.d.ts +36 -0
- package/dist/changelog.d.ts.map +1 -0
- package/dist/changelog.js +143 -0
- package/dist/cli/index.js +1 -1
- package/dist/internal/changelog-entries.d.ts +8 -0
- package/dist/internal/changelog-entries.d.ts.map +1 -0
- package/dist/internal/changelog-entries.js +25 -0
- package/dist/internal/changelog-feed.d.ts +10 -0
- package/dist/internal/changelog-feed.d.ts.map +1 -0
- package/dist/internal/changelog-feed.js +89 -0
- package/dist/internal/changelog.d.ts +36 -0
- package/dist/internal/changelog.d.ts.map +1 -0
- package/dist/internal/changelog.js +98 -0
- package/dist/pages/changelog.d.ts +31 -0
- package/dist/pages/changelog.d.ts.map +1 -0
- package/dist/pages/changelog.js +86 -0
- package/dist/proxy.d.ts +3 -1
- package/dist/proxy.d.ts.map +1 -1
- package/dist/proxy.js +6 -3
- package/dist/routes/changelog.d.ts +43 -0
- package/dist/routes/changelog.d.ts.map +1 -0
- package/dist/routes/changelog.js +81 -0
- package/docs/agents.md +2 -1
- package/docs/llms.txt +405 -2
- package/docs/manifest.json +10 -1
- package/docs/pages/changelog.md +385 -0
- package/docs/pages/proxy.md +14 -1
- package/docs/sitemap.md +1 -0
- package/package.json +14 -1
- package/template/content/docs/changelog.mdx +382 -0
- package/template/content/docs/meta.json +1 -0
- package/template/content/docs/proxy.mdx +14 -1
- package/template/package.json +1 -1
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { notFound, redirect } from "next/navigation";
|
|
3
|
+
import { getChangelogPage, getChangelogPageParams, getChangelogPagePath, getChangelogPath, parseChangelogPage, } from "../internal/changelog";
|
|
4
|
+
import { ChangelogFeed } from "../internal/changelog-feed";
|
|
5
|
+
import { getGeistdocsLanguageConfig } from "../internal/languages";
|
|
6
|
+
import { GeistdocsPageActions } from "../internal/page-actions-client";
|
|
7
|
+
const TRAILING_SLASH_PATTERN = /\/$/;
|
|
8
|
+
export const createChangelogPage = (options) => {
|
|
9
|
+
const { config, source, path = "/changelog", title = "Changelog", description = "The latest releases, improvements, and fixes.", getLang, markdownPath, dataPath, pageSize = 10, } = options;
|
|
10
|
+
const { languages } = getGeistdocsLanguageConfig(config);
|
|
11
|
+
const resolveLang = async ({ params }) => {
|
|
12
|
+
const lang = getLang ? await getLang() : (await params).lang;
|
|
13
|
+
if (!languages.includes(lang)) {
|
|
14
|
+
notFound();
|
|
15
|
+
}
|
|
16
|
+
return lang;
|
|
17
|
+
};
|
|
18
|
+
const markdownHref = (lang, page) => page === 1
|
|
19
|
+
? getChangelogPath(config, markdownPath, lang)
|
|
20
|
+
: `${getChangelogPagePath(config, path, lang, page)}.md`;
|
|
21
|
+
const metadataForPage = (lang, page) => {
|
|
22
|
+
const canonicalPath = getChangelogPagePath(config, path, lang, page);
|
|
23
|
+
const canonical = config.siteUrl
|
|
24
|
+
? new URL(canonicalPath, config.siteUrl).toString()
|
|
25
|
+
: canonicalPath;
|
|
26
|
+
const pageTitle = page === 1 ? title : `${title} - Page ${page}`;
|
|
27
|
+
return {
|
|
28
|
+
title: pageTitle,
|
|
29
|
+
description,
|
|
30
|
+
alternates: {
|
|
31
|
+
canonical,
|
|
32
|
+
...(markdownPath
|
|
33
|
+
? { types: { "text/markdown": markdownHref(lang, page) } }
|
|
34
|
+
: {}),
|
|
35
|
+
},
|
|
36
|
+
openGraph: {
|
|
37
|
+
title: pageTitle,
|
|
38
|
+
description,
|
|
39
|
+
type: "website",
|
|
40
|
+
url: canonical,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
const renderPage = async (lang, page) => {
|
|
45
|
+
const data = await getChangelogPage({ source, lang, page, pageSize });
|
|
46
|
+
if (!data) {
|
|
47
|
+
notFound();
|
|
48
|
+
}
|
|
49
|
+
const actionPage = {
|
|
50
|
+
markdownUrl: markdownHref(lang, page),
|
|
51
|
+
url: getChangelogPagePath(config, path, lang, page),
|
|
52
|
+
};
|
|
53
|
+
return (_jsxs("main", { className: "mx-auto w-full max-w-[1080px] px-6 pt-16 pb-32 font-sans sm:px-10 lg:pt-24", id: "geistdocs-changelog", children: [_jsxs("header", { className: "border-gray-400 border-b pb-12 lg:pb-16", children: [_jsxs("div", { className: "flex flex-col-reverse gap-4 md:flex-row md:items-end md:justify-between", children: [_jsx("h1", { className: "text-gray-1000 text-heading-40 tracking-tighter", children: title }), markdownPath ? (_jsx(GeistdocsPageActions, { config: config, only: "desktop", page: actionPage })) : null] }), _jsx("p", { className: "mt-5 max-w-xl text-balance text-gray-900 text-lg leading-8", children: description }), markdownPath ? (_jsx("div", { className: "mt-5 @min-[961px]:hidden", children: _jsx(GeistdocsPageActions, { config: config, only: "mobile", page: actionPage }) })) : null, page > 1 ? (_jsxs("p", { className: "mt-5 text-gray-900 text-sm", children: ["Page ", page] })) : null] }), _jsx(ChangelogFeed, { dataPath: getChangelogPath(config, dataPath ?? `${path.replace(TRAILING_SLASH_PATTERN, "")}/data`, lang), initialPage: data, lang: lang, path: getChangelogPath(config, path, lang) }, `${lang}:${page}`)] }));
|
|
54
|
+
};
|
|
55
|
+
const Page = async (props) => renderPage(await resolveLang(props), 1);
|
|
56
|
+
const generateMetadata = async (props) => metadataForPage(await resolveLang(props), 1);
|
|
57
|
+
const resolveArchive = async (props) => {
|
|
58
|
+
const lang = await resolveLang(props);
|
|
59
|
+
const page = parseChangelogPage((await props.params).page);
|
|
60
|
+
if (page === null) {
|
|
61
|
+
notFound();
|
|
62
|
+
}
|
|
63
|
+
if (page === 1) {
|
|
64
|
+
redirect(getChangelogPath(config, path, lang));
|
|
65
|
+
}
|
|
66
|
+
return { lang, page };
|
|
67
|
+
};
|
|
68
|
+
const PaginatedPage = async (props) => {
|
|
69
|
+
const { lang, page } = await resolveArchive(props);
|
|
70
|
+
return renderPage(lang, page);
|
|
71
|
+
};
|
|
72
|
+
const generatePaginatedMetadata = async (props) => {
|
|
73
|
+
const { lang, page } = await resolveArchive(props);
|
|
74
|
+
return metadataForPage(lang, page);
|
|
75
|
+
};
|
|
76
|
+
const generateStaticParams = () => languages.map((lang) => ({ lang }));
|
|
77
|
+
const generatePageParams = ({ params, } = {}) => getChangelogPageParams(options, params?.lang);
|
|
78
|
+
return {
|
|
79
|
+
Page,
|
|
80
|
+
PaginatedPage,
|
|
81
|
+
generateMetadata,
|
|
82
|
+
generatePaginatedMetadata,
|
|
83
|
+
generateStaticParams,
|
|
84
|
+
generatePageParams,
|
|
85
|
+
};
|
|
86
|
+
};
|
package/dist/proxy.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export interface GeistdocsMarkdownRoute {
|
|
|
27
27
|
}) => `/${string}`);
|
|
28
28
|
}
|
|
29
29
|
export interface CreateProxyOptions {
|
|
30
|
+
/** Prepend standalone Markdown mappings without replacing docs mappings. */
|
|
31
|
+
additionalMarkdownRoutes?: GeistdocsMarkdownRoute[];
|
|
30
32
|
after?: GeistdocsProxyHook | GeistdocsProxyHook[];
|
|
31
33
|
before?: GeistdocsProxyHook | GeistdocsProxyHook[];
|
|
32
34
|
config: Pick<GeistdocsConfig, "agent" | "basePath" | "content" | "defaultLanguage" | "translations">;
|
|
@@ -38,6 +40,6 @@ export interface CreateProxyOptions {
|
|
|
38
40
|
markdownRoutes?: GeistdocsMarkdownRoute[];
|
|
39
41
|
trackMarkdownRequest?: (event: TrackMarkdownRequestEvent) => Promise<void> | void;
|
|
40
42
|
}
|
|
41
|
-
export declare const createProxy: ({ after, before, config, markdownNotFound, markdownRoutes, trackMarkdownRequest, }: CreateProxyOptions) => (request: NextRequest, context: NextFetchEvent) => Promise<Response>;
|
|
43
|
+
export declare const createProxy: ({ additionalMarkdownRoutes, after, before, config, markdownNotFound, markdownRoutes, trackMarkdownRequest, }: CreateProxyOptions) => (request: NextRequest, context: NextFetchEvent) => Promise<Response>;
|
|
42
44
|
export {};
|
|
43
45
|
//# sourceMappingURL=proxy.d.ts.map
|
package/dist/proxy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../src/proxy.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,WAAW,EAEjB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,UAAU,CAAC;AAQlB,MAAM,MAAM,eAAe,GACvB,UAAU,GACV,iBAAiB,GACjB,WAAW,GACX,IAAI,CAAC;AAET,MAAM,WAAW,yBAAyB;IACxC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE,QAAQ,GAAG,mBAAmB,GAAG,eAAe,CAAC;IAC/D,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,cAAc,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,KAAK,eAAe,GAAG,QAAQ,GAAG,SAAS,GAAG,IAAI,CAAC;AAEnD,MAAM,MAAM,kBAAkB,GAAG,CAC/B,OAAO,EAAE,qBAAqB,KAC3B,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAAC;AAEhD,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,IAAI,MAAM,EAAE,CAAC;IACnB,EAAE,EACE,IAAI,MAAM,EAAE,GACZ,CAAC,CAAC,OAAO,EAAE;QACT,eAAe,EAAE,MAAM,CAAC;QACxB,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,Q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B,KAC7B,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC3B;AAoKD,eAAO,MAAM,WAAW,GAAI,8GAQzB,kBAAkB,MAgTL,SAAS,WAAW,EAAE,SAAS,cAAc,sBAoD5D,CAAC"}
|
package/dist/proxy.js
CHANGED
|
@@ -121,10 +121,13 @@ const getLocalizedPathname = (pathname, languages, defaultLanguage) => {
|
|
|
121
121
|
pathname: `/${segments.slice(1).join("/")}`,
|
|
122
122
|
};
|
|
123
123
|
};
|
|
124
|
-
export const createProxy = ({ after, before, config, markdownNotFound, markdownRoutes, trackMarkdownRequest, }) => {
|
|
124
|
+
export const createProxy = ({ additionalMarkdownRoutes, after, before, config, markdownNotFound, markdownRoutes, trackMarkdownRequest, }) => {
|
|
125
125
|
const agentEnabled = config.agent !== undefined && config.agent.enabled !== false;
|
|
126
|
-
const contentRouteMappings =
|
|
127
|
-
|
|
126
|
+
const contentRouteMappings = [
|
|
127
|
+
...(additionalMarkdownRoutes ?? []),
|
|
128
|
+
...(markdownRoutes ??
|
|
129
|
+
inferMarkdownRoutes(config) ?? [DEFAULT_MARKDOWN_ROUTE]),
|
|
130
|
+
];
|
|
128
131
|
const routeMappings = agentEnabled
|
|
129
132
|
? [...contentRouteMappings, HOME_MARKDOWN_ROUTE]
|
|
130
133
|
: contentRouteMappings;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type ChangelogPageOptions } from "../internal/changelog";
|
|
2
|
+
export type CreateChangelogMarkdownRouteOptions = ChangelogPageOptions;
|
|
3
|
+
export type CreateChangelogDataRouteOptions = ChangelogPageOptions;
|
|
4
|
+
export declare const createChangelogMarkdownRoute: ({ config, source, path, title, description, markdownPath, pageSize, }: CreateChangelogMarkdownRouteOptions) => {
|
|
5
|
+
GET: (_request: Request, { params }: {
|
|
6
|
+
params: Promise<{
|
|
7
|
+
lang?: string;
|
|
8
|
+
page?: string;
|
|
9
|
+
}>;
|
|
10
|
+
}) => Promise<Response>;
|
|
11
|
+
generateStaticParams: ({ params, }?: {
|
|
12
|
+
params?: {
|
|
13
|
+
lang?: string;
|
|
14
|
+
};
|
|
15
|
+
}) => {
|
|
16
|
+
lang: string;
|
|
17
|
+
}[];
|
|
18
|
+
generatePageParams: ({ params, }?: {
|
|
19
|
+
params?: {
|
|
20
|
+
lang?: string;
|
|
21
|
+
};
|
|
22
|
+
}) => Promise<{
|
|
23
|
+
lang: string;
|
|
24
|
+
page: string;
|
|
25
|
+
}[]>;
|
|
26
|
+
};
|
|
27
|
+
export declare const createChangelogDataRoute: (options: CreateChangelogDataRouteOptions) => {
|
|
28
|
+
GET: (_request: Request, { params }: {
|
|
29
|
+
params: Promise<{
|
|
30
|
+
lang?: string;
|
|
31
|
+
page?: string;
|
|
32
|
+
}>;
|
|
33
|
+
}) => Promise<Response>;
|
|
34
|
+
generateStaticParams: ({ params, }?: {
|
|
35
|
+
params?: {
|
|
36
|
+
lang?: string;
|
|
37
|
+
};
|
|
38
|
+
}) => Promise<{
|
|
39
|
+
lang: string;
|
|
40
|
+
page: string;
|
|
41
|
+
}[]>;
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=changelog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changelog.d.ts","sourceRoot":"","sources":["../../src/routes/changelog.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,oBAAoB,EAO1B,MAAM,uBAAuB,CAAC;AAG/B,MAAM,MAAM,mCAAmC,GAAG,oBAAoB,CAAC;AACvE,MAAM,MAAM,+BAA+B,GAAG,oBAAoB,CAAC;AAWnE,eAAO,MAAM,4BAA4B,GAAI,uEAQ1C,mCAAmC;oBAIxB,OAAO,cACL;QAAE,MAAM,EAAE,OAAO,CAAC;YAAE,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE;yCAkDhE;QACD,MAAM,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KAC5B;;;uCAWE;QACD,MAAM,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KAC5B;;;;CAMF,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACnC,SAAS,+BAA+B;oBAM5B,OAAO,cACL;QAAE,MAAM,EAAE,OAAO,CAAC;YAAE,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE;yCAgBhE;QACD,MAAM,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KAC5B;;;;CAYF,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { applyMarkdownHeaders } from "@vercel/agent-readability";
|
|
2
|
+
import { getChangelogEntryTitle, getChangelogPage, getChangelogPageParams, getChangelogPagePath, getChangelogPath, parseChangelogPage, } from "../internal/changelog";
|
|
3
|
+
import { getGeistdocsLanguageConfig } from "../internal/languages";
|
|
4
|
+
const LINE_BREAK_PATTERN = /[\r\n\u2028\u2029]+/g;
|
|
5
|
+
const HEADING_MARKDOWN_PATTERN = /([\\`*_{}[\]<>#|~])/g;
|
|
6
|
+
const TRAILING_SLASH_PATTERN = /\/+$/;
|
|
7
|
+
const escapeHeading = (value) => value
|
|
8
|
+
.replace(LINE_BREAK_PATTERN, " ")
|
|
9
|
+
.replace(HEADING_MARKDOWN_PATTERN, "\\$1");
|
|
10
|
+
export const createChangelogMarkdownRoute = ({ config, source, path = "/changelog", title = "Changelog", description, markdownPath, pageSize, }) => {
|
|
11
|
+
const { defaultLanguage, languages } = getGeistdocsLanguageConfig(config);
|
|
12
|
+
const GET = async (_request, { params }) => {
|
|
13
|
+
const { lang = defaultLanguage, page: pageParam } = await params;
|
|
14
|
+
const page = parseChangelogPage(pageParam);
|
|
15
|
+
if (!languages.includes(lang) || page === null) {
|
|
16
|
+
return new Response("Not Found", { status: 404 });
|
|
17
|
+
}
|
|
18
|
+
const data = await getChangelogPage({ source, lang, page, pageSize });
|
|
19
|
+
if (!data) {
|
|
20
|
+
return new Response("Not Found", { status: 404 });
|
|
21
|
+
}
|
|
22
|
+
const canonicalPath = getChangelogPagePath(config, path, lang, page);
|
|
23
|
+
const headers = applyMarkdownHeaders(new Headers({ "Content-Type": "text/markdown; charset=utf-8" }), {
|
|
24
|
+
canonicalUrl: config.siteUrl
|
|
25
|
+
? new URL(canonicalPath, config.siteUrl)
|
|
26
|
+
: canonicalPath,
|
|
27
|
+
});
|
|
28
|
+
const releases = data.entries.map((entry) => `## ${escapeHeading(getChangelogEntryTitle(entry))} {#${entry.id}}\n\n${entry.publishedAt ? `${entry.publishedAt}\n\n` : ""}${entry.body}`);
|
|
29
|
+
const markdownPagePath = (number) => number === 1
|
|
30
|
+
? getChangelogPath(config, markdownPath ??
|
|
31
|
+
`${path.replace(TRAILING_SLASH_PATTERN, "") || "/"}.md`, lang)
|
|
32
|
+
: `${getChangelogPagePath(config, path, lang, number)}.md`;
|
|
33
|
+
return new Response([
|
|
34
|
+
`# ${escapeHeading(page === 1 ? title : `${title} - Page ${page}`)}`,
|
|
35
|
+
...(description ? [description] : []),
|
|
36
|
+
...releases,
|
|
37
|
+
...(page > 1 ? [`[Previous](${markdownPagePath(page - 1)})`] : []),
|
|
38
|
+
...(data.nextPage
|
|
39
|
+
? [`[Next](${markdownPagePath(data.nextPage)})`]
|
|
40
|
+
: []),
|
|
41
|
+
].join("\n\n"), { headers });
|
|
42
|
+
};
|
|
43
|
+
const generateStaticParams = ({ params, } = {}) => {
|
|
44
|
+
const { lang } = params ?? {};
|
|
45
|
+
return (lang === undefined
|
|
46
|
+
? languages
|
|
47
|
+
: languages.filter((language) => language === lang)).map((language) => ({ lang: language }));
|
|
48
|
+
};
|
|
49
|
+
const generatePageParams = ({ params, } = {}) => {
|
|
50
|
+
const { lang } = params ?? {};
|
|
51
|
+
return getChangelogPageParams({ config, source, pageSize }, lang);
|
|
52
|
+
};
|
|
53
|
+
return { GET, generateStaticParams, generatePageParams };
|
|
54
|
+
};
|
|
55
|
+
export const createChangelogDataRoute = (options) => {
|
|
56
|
+
const { config, source, pageSize } = options;
|
|
57
|
+
const { defaultLanguage, languages } = getGeistdocsLanguageConfig(config);
|
|
58
|
+
const GET = async (_request, { params }) => {
|
|
59
|
+
const { lang = defaultLanguage, page: pageParam } = await params;
|
|
60
|
+
const page = parseChangelogPage(pageParam);
|
|
61
|
+
if (!languages.includes(lang) || page === null) {
|
|
62
|
+
return new Response("Not Found", { status: 404 });
|
|
63
|
+
}
|
|
64
|
+
const data = await getChangelogPage({ source, lang, page, pageSize });
|
|
65
|
+
if (!data) {
|
|
66
|
+
return new Response("Not Found", { status: 404 });
|
|
67
|
+
}
|
|
68
|
+
return Response.json(data);
|
|
69
|
+
};
|
|
70
|
+
const generateStaticParams = async ({ params, } = {}) => {
|
|
71
|
+
const { lang } = params ?? {};
|
|
72
|
+
const archives = await getChangelogPageParams(options, lang);
|
|
73
|
+
return languages
|
|
74
|
+
.filter((language) => lang === undefined || language === lang)
|
|
75
|
+
.flatMap((language) => [
|
|
76
|
+
{ lang: language, page: "1" },
|
|
77
|
+
...archives.filter((archive) => archive.lang === language),
|
|
78
|
+
]);
|
|
79
|
+
};
|
|
80
|
+
return { GET, generateStaticParams };
|
|
81
|
+
};
|
package/docs/agents.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Geistdocs Package Docs
|
|
2
2
|
|
|
3
|
-
These docs are bundled with `@vercel/geistdocs` 1.
|
|
3
|
+
These docs are bundled with `@vercel/geistdocs` 1.28.0 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
|
|
@@ -32,6 +32,7 @@ They are generated from `apps/template/content/docs` during the package build.
|
|
|
32
32
|
- [Geistdocs Provider](pages/provider.md): The root provider component that wraps your application to handle toast notifications, search, and analytics.
|
|
33
33
|
- [Versioned docs](pages/versioned-docs.md): Use createVersionedSources to configure stable, pre-release, or host-based documentation versions.
|
|
34
34
|
- [Proxy and markdown routes](pages/proxy.md): Configure createProxy with generated route discovery, request hooks, markdown mappings, and a static Next.js matcher.
|
|
35
|
+
- [Add a changelog](pages/changelog.md): Connect collection or paged ChangelogSource data to five thin HTML, Markdown, and JSON adapters, preserving existing docs mappings.
|
|
35
36
|
- [.md Extension](pages/md.md): Access any documentation page as raw Markdown by appending .md or .mdx to the URL for AI tool consumption.
|
|
36
37
|
- [Agent readiness](pages/agent-readiness.md): Generate /agents.md and /.well-known/mcp.json from Geistdocs config so agents can find docs, Markdown surfaces, API specs, and MCP endpoints.
|
|
37
38
|
- [Ask AI](pages/ask-ai.md): An AI-powered chat assistant with context-aware search, persistent history, and suggested prompts for your documentation.
|