@tenphi/cookbook 0.15.0 → 0.17.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/README.md +25 -0
- package/dist/config.d.ts +2 -2
- package/dist/index.d.ts +2 -2
- package/docs/ai-agents.md +61 -0
- package/docs/architecture.md +91 -0
- package/docs/authoring.mdx +86 -0
- package/docs/cli.md +88 -0
- package/docs/configuration.md +587 -0
- package/docs/content-sources.md +178 -0
- package/docs/customization-rules.md +154 -0
- package/docs/deployment.md +95 -0
- package/docs/examples.md +101 -0
- package/docs/getting-started.md +134 -0
- package/docs/index.md +74 -0
- package/docs/migration.md +36 -0
- package/docs/starlight-comparison.md +124 -0
- package/docs/theme-and-components.md +745 -0
- package/docs/upstream/glaze/LICENSE +21 -0
- package/docs/upstream/glaze/README.md +156 -0
- package/docs/upstream/glaze/docs/api.md +2021 -0
- package/docs/upstream/glaze/docs/methodology.md +686 -0
- package/docs/upstream/glaze/docs/migration.md +351 -0
- package/docs/upstream/glaze/docs/okhst.md +207 -0
- package/docs/upstream/manifest.json +18 -0
- package/docs/upstream/tasty/LICENSE +21 -0
- package/docs/upstream/tasty/README.md +685 -0
- package/docs/upstream/tasty/docs/README.md +39 -0
- package/docs/upstream/tasty/docs/adoption.md +323 -0
- package/docs/upstream/tasty/docs/ai-agents.md +229 -0
- package/docs/upstream/tasty/docs/comparison.md +448 -0
- package/docs/upstream/tasty/docs/configuration.md +823 -0
- package/docs/upstream/tasty/docs/debug.md +335 -0
- package/docs/upstream/tasty/docs/design-system.md +455 -0
- package/docs/upstream/tasty/docs/dsl.md +1021 -0
- package/docs/upstream/tasty/docs/getting-started.md +238 -0
- package/docs/upstream/tasty/docs/injector.md +634 -0
- package/docs/upstream/tasty/docs/methodology.md +648 -0
- package/docs/upstream/tasty/docs/migration-v3.md +285 -0
- package/docs/upstream/tasty/docs/pipeline.md +749 -0
- package/docs/upstream/tasty/docs/plugins.md +353 -0
- package/docs/upstream/tasty/docs/react-api.md +681 -0
- package/docs/upstream/tasty/docs/runtime-benchmarks.md +351 -0
- package/docs/upstream/tasty/docs/ssr.md +610 -0
- package/docs/upstream/tasty/docs/styles.md +677 -0
- package/docs/upstream/tasty/docs/tasty-static.md +582 -0
- package/package.json +12 -7
|
@@ -0,0 +1,587 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Configuration reference
|
|
3
|
+
description: Configure site metadata, head elements, content, navigation, Markdown, search, theme, and build validation.
|
|
4
|
+
sidebar:
|
|
5
|
+
order: 4
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Use `defineDocsConfig()` for type inference and immediate validation of unknown
|
|
9
|
+
keys:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { defineDocsConfig } from "@tenphi/cookbook/config";
|
|
13
|
+
|
|
14
|
+
export default defineDocsConfig({
|
|
15
|
+
site: { title: "Example" },
|
|
16
|
+
content: { sources: [{ file: "README.md", route: "/" }] },
|
|
17
|
+
});
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Cookbook validates the configuration when it loads. Unknown top-level and
|
|
21
|
+
section keys are errors.
|
|
22
|
+
|
|
23
|
+
## Project resolution and presets
|
|
24
|
+
|
|
25
|
+
`cookbook()` and CLI commands discover the same `docs.config.ts`. Set `root`
|
|
26
|
+
to a directory relative to this file to change where content, local assets,
|
|
27
|
+
and the lock live. `--root` chooses the CLI's configuration search directory;
|
|
28
|
+
`--config` chooses a config file. An inline integration `config` object skips
|
|
29
|
+
discovery and resolves its `root` relative to the integration root.
|
|
30
|
+
|
|
31
|
+
Use `mergeDocsConfig(preset, overrides)` to compose shared configuration. Objects
|
|
32
|
+
merge recursively and arrays replace. Each `theme.fonts` role replaces its
|
|
33
|
+
previous definition, so switching a role from Google to local files takes one
|
|
34
|
+
override. Tasty styles preserve default values when adding conditional
|
|
35
|
+
overrides. Neither input is mutated. See
|
|
36
|
+
[working examples](./examples.md#share-configuration-and-themes).
|
|
37
|
+
|
|
38
|
+
## Redirects
|
|
39
|
+
|
|
40
|
+
Map old routes to collected document routes:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
redirects: { "/old-guide": "/getting-started" }
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Pages can also declare `aliases: ["/old-guide"]` in frontmatter. Page aliases are
|
|
47
|
+
relative to the source mount. Cookbook rejects collisions, cycles, and missing
|
|
48
|
+
targets, collapses chains, and lets Astro emit static redirects. Internal links
|
|
49
|
+
using an alias are rewritten to the canonical route.
|
|
50
|
+
|
|
51
|
+
## Site
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
site: {
|
|
55
|
+
title: "Example Project",
|
|
56
|
+
version: "1.2.3",
|
|
57
|
+
description: "Documentation for Example Project",
|
|
58
|
+
url: "https://docs.example.com",
|
|
59
|
+
repository: "https://github.com/example/project",
|
|
60
|
+
favicon: "./assets/brand.svg"
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
`version` is the documented package version shown beside the site title. A site
|
|
65
|
+
with one locked npm package source infers its version automatically; set this
|
|
66
|
+
field for local or multi-package documentation. Read it from the package
|
|
67
|
+
manifest when possible so it remains current. `url` configures Astro's canonical
|
|
68
|
+
site origin and sitemap metadata. If Astro also declares `site`, the values must
|
|
69
|
+
match. It also lets Cookbook put absolute page URLs in `llms.txt` and a sitemap
|
|
70
|
+
pointer in the origin-root `robots.txt`. `repository` adds a source link to the
|
|
71
|
+
header.
|
|
72
|
+
|
|
73
|
+
For multiple documentation versions, set `site.versions` and mount content at
|
|
74
|
+
each version root. The header then shows a version selector. It links to the
|
|
75
|
+
same route in another version when that page exists and falls back to the
|
|
76
|
+
other version's root when it does not:
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
site: {
|
|
80
|
+
versions: [
|
|
81
|
+
{ label: "Latest", routeBase: "/" },
|
|
82
|
+
{ label: "v1", routeBase: "/v1" },
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
content: {
|
|
86
|
+
sources: [
|
|
87
|
+
{ file: "README.md", route: "/" },
|
|
88
|
+
{ glob: "docs/**/*.md", base: "docs" },
|
|
89
|
+
{ file: "versions/v1/README.md", routeBase: "/v1", route: "/" },
|
|
90
|
+
{ glob: "versions/v1/docs/**/*.md", base: "versions/v1/docs", routeBase: "/v1" },
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Each `routeBase` must have a page, and version roots must be distinct. A
|
|
96
|
+
single-version site can continue using `site.version` for a simple label.
|
|
97
|
+
|
|
98
|
+
### Site icons
|
|
99
|
+
|
|
100
|
+
Cookbook ships its book mark as the default favicon. Set `site.favicon` to a
|
|
101
|
+
local SVG, PNG, JPEG, WebP, AVIF, or GIF when the documentation should use the
|
|
102
|
+
project's own artwork:
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
site: {
|
|
106
|
+
title: "Example Project",
|
|
107
|
+
favicon: {
|
|
108
|
+
source: "./assets/brand.svg",
|
|
109
|
+
background: "#315efb"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Paths are resolved from the project root. The string shorthand sets only the
|
|
115
|
+
source, as in `favicon: "./assets/brand.svg"`. `background` controls the opaque
|
|
116
|
+
canvas used for the Apple touch icon and maskable application icons; it defaults
|
|
117
|
+
to Cookbook blue.
|
|
118
|
+
|
|
119
|
+
At development and build time, Cookbook creates a scalable favicon when the
|
|
120
|
+
source is SVG, a 32×32 PNG fallback, a 180×180 Apple touch icon, 192×192 and
|
|
121
|
+
512×512 application icons, safe-zone maskable variants, and a web app manifest.
|
|
122
|
+
It also emits modern `rel="icon"`, `rel="apple-touch-icon"`, and
|
|
123
|
+
`rel="manifest"` links plus light and dark `theme-color` metadata. Generated
|
|
124
|
+
files live under `/_cookbook/icons/`, respect Astro's `base`, and do not modify
|
|
125
|
+
the project's `public/` directory. The maskable variants render the source artwork
|
|
126
|
+
at 80% of the canvas on the configured opaque background.
|
|
127
|
+
|
|
128
|
+
These outputs follow current browser guidance for
|
|
129
|
+
[multiple icon formats and sizes](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/How_to/Define_app_icons),
|
|
130
|
+
[manifest icon purposes](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Manifest/Reference/icons),
|
|
131
|
+
and the
|
|
132
|
+
[180×180 Apple touch icon](https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html).
|
|
133
|
+
|
|
134
|
+
## Head
|
|
135
|
+
|
|
136
|
+
Add custom elements to every page's `<head>` with the `head` array. This is the
|
|
137
|
+
preferred configuration for analytics scripts and other remote resources:
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
head: [
|
|
141
|
+
{
|
|
142
|
+
tag: "script",
|
|
143
|
+
attrs: {
|
|
144
|
+
defer: true,
|
|
145
|
+
src: "https://analytics.example.com/script.js",
|
|
146
|
+
"data-website-id": "YOUR-WEBSITE-ID",
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Each entry accepts a `tag`, optional string or boolean `attrs`, and optional
|
|
153
|
+
string `content`. Cookbook renders these entries directly as HTML elements;
|
|
154
|
+
they do not pass through Astro's script or style processing. Use a `Head`
|
|
155
|
+
component override when a local asset needs Astro processing.
|
|
156
|
+
|
|
157
|
+
## Page metadata
|
|
158
|
+
|
|
159
|
+
Enable source-aware edit links and Git timestamps for the page footer:
|
|
160
|
+
|
|
161
|
+
```ts
|
|
162
|
+
editLink: {
|
|
163
|
+
baseUrl: "https://github.com/example/project/edit/main/"
|
|
164
|
+
},
|
|
165
|
+
lastUpdated: true,
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Cookbook joins `editLink.baseUrl` with each original repository-relative source
|
|
169
|
+
path, not a generated content-collection path. Set `editUrl: false` or
|
|
170
|
+
`lastUpdated: false` in a page's frontmatter to opt that page out; a string
|
|
171
|
+
`editUrl` or date-valued `lastUpdated` overrides the generated value. Package
|
|
172
|
+
sources show a timestamp only when their materialized file has Git history or
|
|
173
|
+
the page supplies one explicitly.
|
|
174
|
+
|
|
175
|
+
These settings intentionally mirror Starlight's
|
|
176
|
+
[`editLink`](https://starlight.astro.build/reference/configuration/#editlink)
|
|
177
|
+
and
|
|
178
|
+
[`lastUpdated`](https://starlight.astro.build/reference/configuration/#lastupdated)
|
|
179
|
+
configuration while preserving Cookbook's original source paths.
|
|
180
|
+
|
|
181
|
+
Cookbook also accepts Starlight-compatible page presentation frontmatter:
|
|
182
|
+
|
|
183
|
+
```yaml
|
|
184
|
+
tableOfContents:
|
|
185
|
+
minHeadingLevel: 2
|
|
186
|
+
maxHeadingLevel: 4
|
|
187
|
+
pagefind: true
|
|
188
|
+
banner:
|
|
189
|
+
content: This API is experimental.
|
|
190
|
+
hero:
|
|
191
|
+
image:
|
|
192
|
+
file: ./assets/product.svg
|
|
193
|
+
sidebar:
|
|
194
|
+
label: Quick start
|
|
195
|
+
order: 1
|
|
196
|
+
group: Guides
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Set `sidebar: false` to omit a page from generated sidebars. `label`, `order`,
|
|
200
|
+
and `group` affect both the default sidebar and autogenerated navigation
|
|
201
|
+
directories. Relative hero images are validated, content-hashed, and copied
|
|
202
|
+
with the page's other local assets. Unrecognized frontmatter is preserved as graph entry `metadata`, outside the
|
|
203
|
+
renderer frontmatter. Use `content.frontmatter: "reject"` to reject unrelated
|
|
204
|
+
fields. Other supported fields include `aliases`, `template`, `hero`, `editUrl`,
|
|
205
|
+
`lastUpdated`, `prev`, `next`, `head`, `draft`, and `slug`.
|
|
206
|
+
|
|
207
|
+
## Languages
|
|
208
|
+
|
|
209
|
+
Expose Starlight's multilingual routing and language picker directly:
|
|
210
|
+
|
|
211
|
+
```ts
|
|
212
|
+
locales: {
|
|
213
|
+
root: { label: "English", lang: "en" },
|
|
214
|
+
fr: { label: "Français", lang: "fr" },
|
|
215
|
+
ar: { label: "العربية", lang: "ar", dir: "rtl" }
|
|
216
|
+
},
|
|
217
|
+
defaultLocale: "root",
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Locale keys other than `root` are URL prefixes. A source routed to `/fr/guide`
|
|
221
|
+
is the French counterpart of `/guide`; `defaultLocale` provides fallback
|
|
222
|
+
content when a translated route is missing. See Starlight's
|
|
223
|
+
[internationalization guide](https://starlight.astro.build/guides/i18n/) for
|
|
224
|
+
the shared routing and fallback behavior.
|
|
225
|
+
|
|
226
|
+
## Content
|
|
227
|
+
|
|
228
|
+
```ts
|
|
229
|
+
content: {
|
|
230
|
+
sources: [
|
|
231
|
+
{ file: "README.md", route: "/" },
|
|
232
|
+
{ glob: "docs/**/*.{md,mdx}", base: "docs" }
|
|
233
|
+
],
|
|
234
|
+
allowOutsideRoot: false,
|
|
235
|
+
localizeRepositoryLinks: false,
|
|
236
|
+
frontmatter: "preserve"
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
See [Content sources](./content-sources.md) for every declaration and its route
|
|
241
|
+
rules. Enable `localizeRepositoryLinks` to turn absolute repository `blob`,
|
|
242
|
+
`tree`, `raw`, or Bitbucket `src` links back into local Cookbook routes when a
|
|
243
|
+
matching page was collected. Cookbook uses `site.repository` for local sources
|
|
244
|
+
and each package manifest's `repository` metadata for package sources.
|
|
245
|
+
|
|
246
|
+
## Navigation
|
|
247
|
+
|
|
248
|
+
Navigation can mix direct routes, nested groups, autogenerated directories,
|
|
249
|
+
and external links. Groups are recursive and can be nested to any practical
|
|
250
|
+
depth. Use the object form to add an optional primary tab row above the
|
|
251
|
+
documentation shell:
|
|
252
|
+
|
|
253
|
+
```ts
|
|
254
|
+
navigation: {
|
|
255
|
+
tabs: [
|
|
256
|
+
{
|
|
257
|
+
label: "Guides",
|
|
258
|
+
link: "/",
|
|
259
|
+
items: [
|
|
260
|
+
"/",
|
|
261
|
+
{
|
|
262
|
+
label: "Build",
|
|
263
|
+
items: [
|
|
264
|
+
{
|
|
265
|
+
label: "Frontend",
|
|
266
|
+
items: [
|
|
267
|
+
{
|
|
268
|
+
label: "Frameworks",
|
|
269
|
+
items: ["/react", "/vue"]
|
|
270
|
+
}
|
|
271
|
+
]
|
|
272
|
+
}
|
|
273
|
+
]
|
|
274
|
+
}
|
|
275
|
+
]
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
label: "API",
|
|
279
|
+
link: "/reference",
|
|
280
|
+
items: [
|
|
281
|
+
{
|
|
282
|
+
label: "Reference",
|
|
283
|
+
autogenerate: { directory: "/reference" }
|
|
284
|
+
}
|
|
285
|
+
]
|
|
286
|
+
},
|
|
287
|
+
{ label: "Playground", link: "https://example.com/playground" }
|
|
288
|
+
],
|
|
289
|
+
items: [
|
|
290
|
+
"/",
|
|
291
|
+
{
|
|
292
|
+
label: "Start here",
|
|
293
|
+
items: ["/getting-started", "/configuration"]
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
label: "Reference",
|
|
297
|
+
autogenerate: { directory: "/reference" }
|
|
298
|
+
}
|
|
299
|
+
]
|
|
300
|
+
}
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
Give a group an optional `link` to use its header as a parent page:
|
|
304
|
+
|
|
305
|
+
```ts
|
|
306
|
+
{
|
|
307
|
+
label: "Charts",
|
|
308
|
+
link: "/charts",
|
|
309
|
+
items: [
|
|
310
|
+
{
|
|
311
|
+
label: "Chart types",
|
|
312
|
+
link: "/charts/types",
|
|
313
|
+
autogenerate: { directory: "/charts/types" }
|
|
314
|
+
}
|
|
315
|
+
]
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
Group links must name existing root-relative page routes, without the deployment
|
|
320
|
+
base, a query, or a fragment. The parent page is omitted from its children if it
|
|
321
|
+
also appears in the manual list or autogenerated directory. It remains in
|
|
322
|
+
previous/next page navigation. A group with no remaining children becomes a
|
|
323
|
+
regular page link.
|
|
324
|
+
|
|
325
|
+
Top-level sections stay flat; their linked headings navigate to their pages.
|
|
326
|
+
For nested groups, clicking an unselected header or its chevron selects the parent
|
|
327
|
+
page and opens its children, keeping them open if already expanded. Clicking the
|
|
328
|
+
selected parent toggles its children without reloading. Selecting and collapsing
|
|
329
|
+
an open, unselected group therefore takes two clicks. Enter and Space work too, while modified clicks and opening a link
|
|
330
|
+
in a new tab retain normal link behavior. Groups without a `link` only toggle.
|
|
331
|
+
Only the selected page is highlighted; its ancestors keep their normal styling.
|
|
332
|
+
|
|
333
|
+
Tabs are omitted when `tabs` is not set. Give a tab `items` to replace the
|
|
334
|
+
sidebar for that section. Those items also establish section membership, so a
|
|
335
|
+
tab can own routes that do not share its URL prefix. A tab stays active for
|
|
336
|
+
pages nested below its link; `/` matches only the home page. When multiple tabs
|
|
337
|
+
could match, an exact tab link wins, followed by the longest link prefix and
|
|
338
|
+
then sidebar membership. Tabs without `items` use the top-level `items`
|
|
339
|
+
fallback. Every internal route named anywhere in navigation must exist.
|
|
340
|
+
|
|
341
|
+
## Theme
|
|
342
|
+
|
|
343
|
+
```ts
|
|
344
|
+
theme: {
|
|
345
|
+
brand: {
|
|
346
|
+
from: "#2f5bff",
|
|
347
|
+
contrast: { apca: [45, 60] }
|
|
348
|
+
},
|
|
349
|
+
palette: {
|
|
350
|
+
surface: { tone: 98, saturation: 0.05 },
|
|
351
|
+
text: {
|
|
352
|
+
base: "surface",
|
|
353
|
+
tone: "-10",
|
|
354
|
+
saturation: 0,
|
|
355
|
+
contrast: { wcag: [7, 10] }
|
|
356
|
+
},
|
|
357
|
+
textSoft: {
|
|
358
|
+
base: "surface",
|
|
359
|
+
tone: "-10",
|
|
360
|
+
saturation: 0.05,
|
|
361
|
+
contrast: { wcag: [4.5, 7] }
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
fonts: {
|
|
365
|
+
body: "Inter",
|
|
366
|
+
heading: { google: "Newsreader", weights: [400, 700] },
|
|
367
|
+
code: {
|
|
368
|
+
family: "Project Mono",
|
|
369
|
+
files: [{ src: "/fonts/project-mono.woff2", weight: "100 900" }]
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
tokens: {
|
|
373
|
+
"$radius": "8px",
|
|
374
|
+
"$card-radius": "16px",
|
|
375
|
+
"$border-width": "1px",
|
|
376
|
+
"$layout-width": "87.5rem",
|
|
377
|
+
"$content-width": "58rem",
|
|
378
|
+
"$sidebar-width": "17.5rem"
|
|
379
|
+
},
|
|
380
|
+
states: {},
|
|
381
|
+
presets: {
|
|
382
|
+
body: { boldFontWeight: 680 },
|
|
383
|
+
heading: {
|
|
384
|
+
fontWeight: 650,
|
|
385
|
+
boldFontWeight: 740
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
styles: {
|
|
389
|
+
ThemeSelect: {
|
|
390
|
+
Select: { border: "#border-strong" },
|
|
391
|
+
Picker: { shadow: "0 1rem 3rem #shadow" }
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
contrastLevel: "auto"
|
|
395
|
+
}
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
The default brand is `okhsl(266 68% 48%)`, a blue with 68% saturation; controls
|
|
399
|
+
use an `8px` radius and cards use `16px`. Onest is the default body and heading family, while JetBrains Mono is
|
|
400
|
+
used for code. `theme.fonts` loads Google families by name or local files from
|
|
401
|
+
`public/`, and applies them to the body, heading, and code presets. See
|
|
402
|
+
[Change font families](./theme-and-components.md#change-font-families) for both
|
|
403
|
+
flows. The default layout is capped at `87.5rem` (1400px), matching the
|
|
404
|
+
Tasty site, with a `58rem` reading column and a `17.5rem` sidebar. `brand.from`
|
|
405
|
+
supplies the color seed. `palette` supplies semantic Glaze declarations that
|
|
406
|
+
inherit its hue and saturation unless a role supplies its own `from`. `tone` and
|
|
407
|
+
a saturation factor set the surface; `base` and `contrast` express reading-color
|
|
408
|
+
requirements against that surface. Glaze resolves light, dark, and both
|
|
409
|
+
high-contrast modes independently. Literal color shorthand and structured
|
|
410
|
+
brand hue/saturation/tone remain supported. A requested APCA floor below 45 requires the explicit
|
|
411
|
+
`unsafeContrast: true` escape hatch. Learn more in
|
|
412
|
+
[Theme and components](./theme-and-components.md).
|
|
413
|
+
|
|
414
|
+
`theme.styles` is keyed by Cookbook UI surface name. A plain Tasty style object
|
|
415
|
+
contains only the properties to override; Cookbook deep-merges it into that
|
|
416
|
+
surface's complete base object internally. Unknown built-in names and sub-elements are rejected. Register custom
|
|
417
|
+
component names and their overrides in `theme.customStyles`. Structural Astro overrides under
|
|
418
|
+
`components.overrides` remain available when styling alone is insufficient.
|
|
419
|
+
`theme.states` registers additional Tasty state shorthands, and `contrastLevel`
|
|
420
|
+
is forwarded to Glaze's palette resolution.
|
|
421
|
+
The built-in documentation navigation surfaces are available as `Sidebar`,
|
|
422
|
+
`TableOfContents`, `MobileMenuToggle`, and `MobileNavigationTabs`; see
|
|
423
|
+
[Theme and components](./theme-and-components.md#style-customization) for their
|
|
424
|
+
complete sub-element lists.
|
|
425
|
+
|
|
426
|
+
## Markdown
|
|
427
|
+
|
|
428
|
+
```ts
|
|
429
|
+
markdown: {
|
|
430
|
+
stripLeadingBadges: true,
|
|
431
|
+
rawHtml: "sanitize",
|
|
432
|
+
}
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
`stripLeadingBadges` removes badge-only paragraphs at the start of a page and
|
|
436
|
+
defaults to `true`. `rawHtml` accepts `"allow"`, `"sanitize"`, `"strip"`, or `"reject"`.
|
|
437
|
+
The default `sanitize` policy preserves safe elements, including `details`,
|
|
438
|
+
`summary`, tables, and inline emphasis, while removing executable markup,
|
|
439
|
+
event handlers, and presentational attributes. Links and images in sanitized
|
|
440
|
+
HTML pass through the content graph. `strip` removes HTML with a warning,
|
|
441
|
+
`allow` preserves trusted HTML, and `reject` reports a graph error. Package Markdown in safe mode is
|
|
442
|
+
always sanitized even when the global policy is `"allow"`, and package MDX
|
|
443
|
+
requires an explicit `trust: "mdx"` source declaration.
|
|
444
|
+
|
|
445
|
+
Configure renderer-level Markdown options such as custom remark or rehype
|
|
446
|
+
plugins and Shiki languages through Astro's top-level `markdown` configuration.
|
|
447
|
+
Cookbook preserves those settings while adding its own build-time transforms.
|
|
448
|
+
|
|
449
|
+
Starlight content and behavior plugins can be supplied to the Astro integration:
|
|
450
|
+
|
|
451
|
+
```ts
|
|
452
|
+
import myStarlightPlugin from "./plugins/my-starlight-plugin.js";
|
|
453
|
+
|
|
454
|
+
export default defineConfig({
|
|
455
|
+
integrations: [cookbook({ plugins: [myStarlightPlugin()] })],
|
|
456
|
+
});
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
Cookbook forwards these plugins to Starlight. Plugins that add stylesheets or
|
|
460
|
+
style tags fail the production build because Cookbook ships only Tasty styles.
|
|
461
|
+
Plugins that replace
|
|
462
|
+
Cookbook-owned components or change routes can conflict with the content graph.
|
|
463
|
+
Use `theme.styles` for visual changes.
|
|
464
|
+
|
|
465
|
+
Cookbook renders fenced `mermaid` blocks as responsive, theme-aware SVG during
|
|
466
|
+
the static build. Flowcharts, state, sequence, class, and entity-relationship
|
|
467
|
+
diagrams are supported. Invalid or unsupported diagrams remain visible as
|
|
468
|
+
source code.
|
|
469
|
+
|
|
470
|
+
````markdown
|
|
471
|
+
```mermaid
|
|
472
|
+
flowchart TD
|
|
473
|
+
accTitle: Proposal workflow
|
|
474
|
+
accDescr: Evidence is inspected before proposals are decided and applied.
|
|
475
|
+
inspect[Inspect evidence] --> seal[Seal proposals]
|
|
476
|
+
seal --> decide[Decide eligible items]
|
|
477
|
+
decide --> apply[Apply accepted items]
|
|
478
|
+
```
|
|
479
|
+
````
|
|
480
|
+
|
|
481
|
+
```mermaid
|
|
482
|
+
flowchart TD
|
|
483
|
+
accTitle: Proposal workflow
|
|
484
|
+
accDescr: Evidence is inspected before proposals are decided and applied.
|
|
485
|
+
inspect[Inspect evidence] --> seal[Seal proposals]
|
|
486
|
+
seal --> decide[Decide eligible items]
|
|
487
|
+
decide --> apply[Apply accepted items]
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
## Search
|
|
491
|
+
|
|
492
|
+
```ts
|
|
493
|
+
search: {
|
|
494
|
+
enabled: true,
|
|
495
|
+
},
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
Search is generated locally with Pagefind during a static build. Disable it
|
|
499
|
+
for hosts or fixtures that do not need an index.
|
|
500
|
+
|
|
501
|
+
## Components
|
|
502
|
+
|
|
503
|
+
```ts
|
|
504
|
+
components: {
|
|
505
|
+
overrides: {
|
|
506
|
+
Header: "./src/components/Header.astro",
|
|
507
|
+
Footer: "./src/components/Footer.astro"
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
Component replacement is the advanced escape hatch. Prefer theme tokens and
|
|
513
|
+
named styles for visual changes that do not need new structure.
|
|
514
|
+
|
|
515
|
+
Cookbook uses its built-in footer by default, including the “Generated with
|
|
516
|
+
Cookbook” credit. Replace the complete footer with the `Footer` component path
|
|
517
|
+
shown above, or remove it with:
|
|
518
|
+
|
|
519
|
+
```ts
|
|
520
|
+
components: {
|
|
521
|
+
overrides: {
|
|
522
|
+
Footer: false,
|
|
523
|
+
},
|
|
524
|
+
},
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
Disabling the complete footer also removes its edit link, last-updated metadata,
|
|
528
|
+
and previous/next-page navigation.
|
|
529
|
+
|
|
530
|
+
## Build
|
|
531
|
+
|
|
532
|
+
```ts
|
|
533
|
+
build: {
|
|
534
|
+
strict: true,
|
|
535
|
+
ci: process.env.CI === "true",
|
|
536
|
+
cacheDir: "",
|
|
537
|
+
maxArtifactBytes: 25 * 1024 * 1024,
|
|
538
|
+
maxUnpackedBytes: 100 * 1024 * 1024,
|
|
539
|
+
maxFiles: 10_000,
|
|
540
|
+
maxPathDepth: 24,
|
|
541
|
+
maxAssetBytes: 20 * 1024 * 1024
|
|
542
|
+
}
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
`strict` makes missing internal links errors instead of warnings. `ci` makes
|
|
546
|
+
missing heading fragments errors and defaults to `true` when `CI=true`.
|
|
547
|
+
Cookbook derives its public base path from Astro's top-level `base` setting so
|
|
548
|
+
routes and assets cannot drift between two configurations. An empty `cacheDir`
|
|
549
|
+
uses `~/.cache/cookbook`; set an explicit path to relocate downloaded package
|
|
550
|
+
artifacts. Package limits protect builds from unexpected registry artifacts;
|
|
551
|
+
raise them deliberately for a reviewed package.
|
|
552
|
+
|
|
553
|
+
## Header buttons
|
|
554
|
+
|
|
555
|
+
Configure the top bar with `site.headerLinks`. Links appear beside search on
|
|
556
|
+
larger screens and in a More popover below 50rem. The desktop header supports
|
|
557
|
+
primary buttons; More uses a compact, left-aligned list of uniform navigation
|
|
558
|
+
links. Omit the array (or use `[]`) to hide More.
|
|
559
|
+
|
|
560
|
+
```ts
|
|
561
|
+
export default defineDocsConfig({
|
|
562
|
+
site: {
|
|
563
|
+
headerLinks: [
|
|
564
|
+
{
|
|
565
|
+
label: "Changelog",
|
|
566
|
+
link: "https://example.com/changelog",
|
|
567
|
+
newTab: true,
|
|
568
|
+
},
|
|
569
|
+
{ label: "Get started", link: "/getting-started", variant: "primary" },
|
|
570
|
+
],
|
|
571
|
+
},
|
|
572
|
+
});
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
Each entry requires a non-empty `label` and a `link` (an HTTP(S) URL,
|
|
576
|
+
root-relative route, or fragment). Cookbook prefixes root-relative links with
|
|
577
|
+
the Astro base. `variant` is `default` or `primary` and applies on desktop;
|
|
578
|
+
`newTab` defaults to false
|
|
579
|
+
and adds safe new-window attributes when enabled. Customize the complete
|
|
580
|
+
button and popover style tree through `theme.styles.HeaderLinks`.
|
|
581
|
+
|
|
582
|
+
`theme.palette.header` sets the translucent header's color declaration. It defaults
|
|
583
|
+
to `theme.palette.surface`; Glaze resolves it for light, dark, and both high
|
|
584
|
+
contrast modes. Adjust blur and other header styling via `theme.styles.HeaderFrame`.
|
|
585
|
+
`theme.palette.overlay` controls the fixed underlay color, defaulting to black at
|
|
586
|
+
50% opacity in every scheme. The mobile drawer uses the Glaze shadow token and
|
|
587
|
+
a 120ms slide transition; customize these through `theme.styles.Sidebar`.
|