@vercel/geistdocs 2.15.1 → 2.15.3-canary.633944d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +1 -1
- package/dist/internal/search-ranking.d.ts +45 -0
- package/dist/internal/search-ranking.d.ts.map +1 -0
- package/dist/internal/search-ranking.js +186 -0
- package/dist/next.d.ts +9 -1
- package/dist/next.d.ts.map +1 -1
- package/dist/next.js +25 -2
- package/dist/routes/search.d.ts.map +1 -1
- package/dist/routes/search.js +80 -4
- package/dist/source-config.d.ts +10 -1
- package/dist/source-config.d.ts.map +1 -1
- package/dist/source-config.js +20 -10
- package/docs/agents.md +1 -1
- package/docs/llms.txt +24 -1
- package/docs/manifest.json +1 -1
- package/docs/pages/configuration.md +8 -0
- package/docs/pages/provider.md +15 -0
- package/native-mdx/LICENSE-mdxjs-rs +22 -0
- package/native-mdx/binaries/darwin-arm64.node +0 -0
- package/native-mdx/binaries/linux-x64-gnu.node +0 -0
- package/native-mdx/loader-mdx.cjs +9 -0
- package/native-mdx/loader-mdx.mjs +216 -0
- package/native-mdx/native-binding.cjs +25 -0
- package/package.json +15 -8
- package/rehype-code-highlights.d.ts +13 -0
- package/rehype-code-highlights.js +230 -0
- package/source-config.js +24 -10
- package/template/app/[lang]/(home)/opengraph-image.tsx +4 -28
- package/template/app/[lang]/og/[...slug]/route.tsx +5 -68
- package/template/content/docs/configuration.mdx +8 -0
- package/template/content/docs/provider.mdx +15 -0
- package/template/lib/geistdocs/geist-mono-regular.ttf +0 -0
- package/template/lib/geistdocs/og.tsx +95 -0
- package/template/package.json +1 -1
- package/template/app/[lang]/og/[...slug]/background.png +0 -0
- package/template/app/[lang]/og/[...slug]/geist-sans-semibold.ttf +0 -0
- /package/template/{app/[lang]/og/[...slug] → lib/geistdocs}/geist-sans-regular.ttf +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createOpenGraphImage } from "@/lib/geistdocs/og";
|
|
2
2
|
|
|
3
3
|
export const alt = "Geistdocs documentation platform";
|
|
4
4
|
export const contentType = "image/png";
|
|
@@ -8,33 +8,9 @@ export const size = {
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
const OpenGraphImage = () =>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
alignItems: "center",
|
|
15
|
-
background: "#000",
|
|
16
|
-
color: "#fff",
|
|
17
|
-
display: "flex",
|
|
18
|
-
height: "100%",
|
|
19
|
-
justifyContent: "center",
|
|
20
|
-
width: "100%",
|
|
21
|
-
}}
|
|
22
|
-
>
|
|
23
|
-
<div
|
|
24
|
-
style={{
|
|
25
|
-
display: "flex",
|
|
26
|
-
flexDirection: "column",
|
|
27
|
-
gap: 24,
|
|
28
|
-
maxWidth: 920,
|
|
29
|
-
}}
|
|
30
|
-
>
|
|
31
|
-
<div style={{ fontSize: 76, fontWeight: 600 }}>Geistdocs</div>
|
|
32
|
-
<div style={{ color: "#a1a1a1", fontSize: 36, lineHeight: 1.25 }}>
|
|
33
|
-
Package-backed documentation sites for people and agents
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|
|
36
|
-
</div>,
|
|
37
|
-
size
|
|
11
|
+
createOpenGraphImage(
|
|
12
|
+
"Geistdocs",
|
|
13
|
+
"Package-backed documentation sites for people and agents"
|
|
38
14
|
);
|
|
39
15
|
|
|
40
16
|
export default OpenGraphImage;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { ImageResponse } from "next/og";
|
|
4
1
|
import type { NextRequest } from "next/server";
|
|
2
|
+
import { config } from "@/lib/geistdocs/config";
|
|
3
|
+
import { createOpenGraphImage } from "@/lib/geistdocs/og";
|
|
5
4
|
import { getPageImage, source } from "@/lib/geistdocs/source";
|
|
6
5
|
|
|
7
6
|
export const GET = async (
|
|
@@ -15,71 +14,9 @@ export const GET = async (
|
|
|
15
14
|
return new Response("Not found", { status: 404 });
|
|
16
15
|
}
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
join(process.cwd(), "app/[lang]/og/[...slug]/geist-sans-regular.ttf")
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
const semiboldFont = await readFile(
|
|
25
|
-
join(process.cwd(), "app/[lang]/og/[...slug]/geist-sans-semibold.ttf")
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
const backgroundImage = await readFile(
|
|
29
|
-
join(process.cwd(), "app/[lang]/og/[...slug]/background.png")
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
const backgroundImageData = backgroundImage.buffer.slice(
|
|
33
|
-
backgroundImage.byteOffset,
|
|
34
|
-
backgroundImage.byteOffset + backgroundImage.byteLength
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
return new ImageResponse(
|
|
38
|
-
<div style={{ fontFamily: "Geist" }} tw="flex h-full w-full bg-black">
|
|
39
|
-
{/** biome-ignore lint/performance/noImgElement: "Required for Satori" */}
|
|
40
|
-
<img
|
|
41
|
-
alt="Vercel OpenGraph Background"
|
|
42
|
-
height={628}
|
|
43
|
-
src={backgroundImageData as never}
|
|
44
|
-
width={1200}
|
|
45
|
-
/>
|
|
46
|
-
<div tw="flex flex-col absolute h-full w-[750px] justify-center left-[50px] pr-[50px] pt-[116px] pb-[86px]">
|
|
47
|
-
<div
|
|
48
|
-
style={{
|
|
49
|
-
textWrap: "balance",
|
|
50
|
-
}}
|
|
51
|
-
tw="text-5xl font-medium text-white tracking-tight flex leading-[1.1] mb-4"
|
|
52
|
-
>
|
|
53
|
-
{title}
|
|
54
|
-
</div>
|
|
55
|
-
<div
|
|
56
|
-
style={{
|
|
57
|
-
color: "#8B8B8B",
|
|
58
|
-
lineHeight: "44px",
|
|
59
|
-
textWrap: "balance",
|
|
60
|
-
}}
|
|
61
|
-
tw="text-[32px]"
|
|
62
|
-
>
|
|
63
|
-
{description}
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
</div>,
|
|
67
|
-
{
|
|
68
|
-
width: 1200,
|
|
69
|
-
height: 628,
|
|
70
|
-
fonts: [
|
|
71
|
-
{
|
|
72
|
-
name: "Geist",
|
|
73
|
-
data: regularFont,
|
|
74
|
-
weight: 400,
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
name: "Geist",
|
|
78
|
-
data: semiboldFont,
|
|
79
|
-
weight: 500,
|
|
80
|
-
},
|
|
81
|
-
],
|
|
82
|
-
}
|
|
17
|
+
return createOpenGraphImage(
|
|
18
|
+
page.data.title ?? config.title,
|
|
19
|
+
page.data.description
|
|
83
20
|
);
|
|
84
21
|
};
|
|
85
22
|
|
|
@@ -283,6 +283,14 @@ export const docs = defineDocs({
|
|
|
283
283
|
export default defineGeistdocsSourceConfig();
|
|
284
284
|
```
|
|
285
285
|
|
|
286
|
+
### Code highlighter
|
|
287
|
+
|
|
288
|
+
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"`:
|
|
289
|
+
|
|
290
|
+
```ts title="source.config.ts"
|
|
291
|
+
export default defineGeistdocsSourceConfig({ highlighter: "shiki" });
|
|
292
|
+
```
|
|
293
|
+
|
|
286
294
|
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.
|
|
287
295
|
|
|
288
296
|
## Page URLs
|
|
@@ -48,6 +48,21 @@ const Layout = ({ children }: LayoutProps) => (
|
|
|
48
48
|
|
|
49
49
|
The generated local adapter imports the package provider and passes your site config to it.
|
|
50
50
|
|
|
51
|
+
## Search relevance
|
|
52
|
+
|
|
53
|
+
`createSearchRoute` ranks pages before selecting their matching sections. Exact page titles come first, followed by exact `keywords` aliases. These matches retain every query word, so `use cache` ranks ahead of `Cache` for that query. They precede matches with English filler words removed and full-page matches weighted toward titles, keywords, and descriptions. Section overview pages use their navigation folder name instead of the generic “Overview” title. Lower-priority English matching ignores common filler words such as “how to” and “using”; other locales keep their existing tokenizers.
|
|
54
|
+
|
|
55
|
+
Add a small set of search phrases to the canonical page's frontmatter:
|
|
56
|
+
|
|
57
|
+
```yaml
|
|
58
|
+
title: Generating Structured Data
|
|
59
|
+
keywords:
|
|
60
|
+
- structured output
|
|
61
|
+
- structured outputs
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Use phrases readers actually search for, and assign each alias to its canonical page. Avoid copying the same keywords onto every related page. English results must cover the whole query; if no page covers it, partial section matches remain available. Results contain at most 20 pages and two distinct matching snippets per page, retaining section links and breadcrumbs. Locale, visibility, and `filterPage` restrictions still apply.
|
|
65
|
+
|
|
51
66
|
## Search scope
|
|
52
67
|
|
|
53
68
|
A search index partitioned by version, section, or product usually wants the dialog to answer from the partition the reader is in. Pass that scope as `search.options.tag`:
|
|
Binary file
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { LogoIconVercelSvg } from "@vercel/geistdocs/assets/logos";
|
|
4
|
+
import { ImageResponse } from "next/og";
|
|
5
|
+
import { renderToReadableStream } from "react-dom/server.edge";
|
|
6
|
+
|
|
7
|
+
const regularFont = readFile(
|
|
8
|
+
join(process.cwd(), "lib/geistdocs/geist-sans-regular.ttf")
|
|
9
|
+
);
|
|
10
|
+
const monoFont = readFile(
|
|
11
|
+
join(process.cwd(), "lib/geistdocs/geist-mono-regular.ttf")
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
export const createOpenGraphImage = async (
|
|
15
|
+
title: string,
|
|
16
|
+
subheading?: string
|
|
17
|
+
) => {
|
|
18
|
+
// Satori cannot resolve the memoized base component used by Geist icons.
|
|
19
|
+
const logo = await new Response(
|
|
20
|
+
await renderToReadableStream(<LogoIconVercelSvg size={60} />)
|
|
21
|
+
).text();
|
|
22
|
+
|
|
23
|
+
return new ImageResponse(
|
|
24
|
+
<div
|
|
25
|
+
style={{
|
|
26
|
+
backgroundColor: "#000",
|
|
27
|
+
color: "#fff",
|
|
28
|
+
display: "flex",
|
|
29
|
+
fontFamily: "Geist",
|
|
30
|
+
height: "100%",
|
|
31
|
+
width: "100%",
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
<div style={{ display: "flex", left: 64, position: "absolute", top: 56 }}>
|
|
35
|
+
{/** biome-ignore lint/performance/noImgElement: Required for Satori. */}
|
|
36
|
+
<img
|
|
37
|
+
alt="Vercel"
|
|
38
|
+
height={60}
|
|
39
|
+
src={`data:image/svg+xml;base64,${Buffer.from(logo.replaceAll("currentColor", "#fff")).toString("base64")}`}
|
|
40
|
+
width={60}
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
43
|
+
<div
|
|
44
|
+
style={{
|
|
45
|
+
display: "flex",
|
|
46
|
+
flexDirection: "column",
|
|
47
|
+
gap: 24,
|
|
48
|
+
left: 64,
|
|
49
|
+
position: "absolute",
|
|
50
|
+
top: 220,
|
|
51
|
+
width: 810,
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
54
|
+
<div
|
|
55
|
+
style={{
|
|
56
|
+
display: "block",
|
|
57
|
+
fontSize: 80,
|
|
58
|
+
fontWeight: 400,
|
|
59
|
+
letterSpacing: "-0.05em",
|
|
60
|
+
...(subheading ? { lineClamp: 3 } : {}),
|
|
61
|
+
lineHeight: 0.95,
|
|
62
|
+
textWrap: subheading ? "wrap" : "balance",
|
|
63
|
+
width: "100%",
|
|
64
|
+
}}
|
|
65
|
+
>
|
|
66
|
+
{title}
|
|
67
|
+
</div>
|
|
68
|
+
{subheading ? (
|
|
69
|
+
<div
|
|
70
|
+
style={{
|
|
71
|
+
color: "#a1a1a1",
|
|
72
|
+
display: "block",
|
|
73
|
+
fontFamily: "Geist Mono",
|
|
74
|
+
fontSize: 32,
|
|
75
|
+
lineClamp: 2,
|
|
76
|
+
lineHeight: 1.25,
|
|
77
|
+
textWrap: "wrap",
|
|
78
|
+
width: "100%",
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
{subheading}
|
|
82
|
+
</div>
|
|
83
|
+
) : null}
|
|
84
|
+
</div>
|
|
85
|
+
</div>,
|
|
86
|
+
{
|
|
87
|
+
width: 1200,
|
|
88
|
+
height: 630,
|
|
89
|
+
fonts: [
|
|
90
|
+
{ name: "Geist", data: await regularFont, weight: 400 },
|
|
91
|
+
{ name: "Geist Mono", data: await monoFont, weight: 400 },
|
|
92
|
+
],
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
};
|
package/template/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@streamdown/code": "^1.0.1",
|
|
18
18
|
"@vercel/agent-readability": "^0.7.0",
|
|
19
19
|
"@vercel/analytics": "^1.6.1",
|
|
20
|
-
"@vercel/geistdocs": "2.15.
|
|
20
|
+
"@vercel/geistdocs": "2.15.3-canary.633944d",
|
|
21
21
|
"@vercel/speed-insights": "^1.3.1",
|
|
22
22
|
"ai": "^6.0.132",
|
|
23
23
|
"clsx": "^2.1.1",
|
|
Binary file
|
|
Binary file
|
|
File without changes
|