@tenphi/cookbook 0.28.0 → 0.30.1

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 (54) hide show
  1. package/README.md +13 -11
  2. package/dist/index.d.ts +2 -2
  3. package/dist/index.js +2 -2
  4. package/docs/ai-agents.md +5 -3
  5. package/docs/architecture.md +10 -7
  6. package/docs/authoring.mdx +94 -36
  7. package/docs/cli.md +92 -33
  8. package/docs/component-styles.md +286 -282
  9. package/docs/configuration.md +232 -153
  10. package/docs/content-sources.md +39 -21
  11. package/docs/custom-components.md +117 -169
  12. package/docs/customization-rules.md +23 -14
  13. package/docs/deployment.md +101 -53
  14. package/docs/es/getting-started.md +7 -5
  15. package/docs/es/index.md +1 -1
  16. package/docs/examples.md +65 -28
  17. package/docs/fonts-and-typography.md +32 -27
  18. package/docs/getting-started.md +17 -10
  19. package/docs/ja/getting-started.md +7 -5
  20. package/docs/ja/index.md +1 -1
  21. package/docs/migration.md +188 -65
  22. package/docs/plugins.md +28 -16
  23. package/docs/publishing.md +3 -2
  24. package/docs/quality-checks.md +18 -42
  25. package/docs/recipes.md +38 -54
  26. package/docs/ru/getting-started.md +7 -5
  27. package/docs/ru/index.md +1 -1
  28. package/docs/site-navigation.md +47 -47
  29. package/docs/theme-and-components.md +126 -59
  30. package/docs/troubleshooting.md +4 -3
  31. package/docs/upstream/manifest.json +2 -2
  32. package/docs/upstream/tasty/README.md +404 -381
  33. package/docs/upstream/tasty/docs/README.md +4 -1
  34. package/docs/upstream/tasty/docs/adoption.md +25 -17
  35. package/docs/upstream/tasty/docs/ai-agents.md +42 -34
  36. package/docs/upstream/tasty/docs/comparison.md +9 -8
  37. package/docs/upstream/tasty/docs/configuration.md +187 -69
  38. package/docs/upstream/tasty/docs/debug.md +3 -2
  39. package/docs/upstream/tasty/docs/design-system.md +117 -15
  40. package/docs/upstream/tasty/docs/dsl.md +211 -117
  41. package/docs/upstream/tasty/docs/getting-started.md +81 -24
  42. package/docs/upstream/tasty/docs/injector.md +41 -40
  43. package/docs/upstream/tasty/docs/methodology.md +46 -21
  44. package/docs/upstream/tasty/docs/migration-v3.md +3 -3
  45. package/docs/upstream/tasty/docs/pipeline.md +111 -116
  46. package/docs/upstream/tasty/docs/plugins.md +21 -41
  47. package/docs/upstream/tasty/docs/react-api.md +73 -10
  48. package/docs/upstream/tasty/docs/runtime-benchmarks.md +46 -46
  49. package/docs/upstream/tasty/docs/ssr.md +92 -66
  50. package/docs/upstream/tasty/docs/styles.md +37 -17
  51. package/docs/upstream/tasty/docs/tasty-static.md +175 -57
  52. package/docs/zh/getting-started.md +7 -5
  53. package/docs/zh/index.md +1 -1
  54. package/package.json +3 -3
@@ -5,8 +5,8 @@ sidebar:
5
5
  order: 4
6
6
  ---
7
7
 
8
- Use `defineDocsConfig()` for type inference and immediate validation of unknown
9
- keys:
8
+ Use `defineDocsConfig()` in `docs.config.ts` for type inference and immediate
9
+ validation:
10
10
 
11
11
  ```ts
12
12
  import { defineDocsConfig } from "@tenphi/cookbook/config";
@@ -18,46 +18,51 @@ export default defineDocsConfig({
18
18
  ```
19
19
 
20
20
  Cookbook validates the configuration when it loads. Unknown top-level and
21
- section keys are errors.
22
-
23
- Start with a complete [configuration recipe](./recipes.md) for common tasks.
24
- This page documents the available options; [working examples](./examples.md)
25
- covers repository layouts and shared presets.
26
-
27
- For a focused explanation, use [content sources](./content-sources.md),
28
- [theme basics](./theme-and-components.md),
29
- [fonts and typography](./fonts-and-typography.md),
30
- [component styles](./component-styles.md), or
31
- [publishing metadata](./publishing.md). The sections below are the complete
32
- configuration reference.
21
+ section keys are errors. Start with a complete [theme recipe](./recipes.md)
22
+ or [working example](./examples.md); this page documents every option.
23
+
24
+ | Key | Purpose |
25
+ | -------------------------- | ------------------------------------------------------------- |
26
+ | `root` | [Project root](#project-resolution-and-presets) for content |
27
+ | `site` | [Title, URL, versions, logo, icons, header links](#site), SEO |
28
+ | `head` | [Extra `<head>` elements](#head) on every page |
29
+ | `editLink`, `lastUpdated` | [Edit links and timestamps](#edit-links-and-timestamps) |
30
+ | `tableOfContents` | [On-page contents](#table-of-contents) defaults |
31
+ | `locales`, `defaultLocale` | [Languages](#languages) |
32
+ | `translations` | [Interface messages](#translations) |
33
+ | `redirects` | [Old routes](#redirects) |
34
+ | `content` | [Content sources](#content) and link handling |
35
+ | `navigation` | [Tabs, sidebars, and groups](#navigation) |
36
+ | `theme` | [Colors, fonts, tokens, presets, and styles](#theme) |
37
+ | `markdown` | [Raw HTML and badge handling](#markdown) |
38
+ | `search` | [Pagefind search](#search) |
39
+ | `components` | [Astro component overrides](#components) |
40
+ | `build` | [Validation strictness and limits](#build) |
41
+
42
+ Page-level settings live in each page's frontmatter; see
43
+ [page frontmatter](#page-frontmatter).
33
44
 
34
45
  ## Project resolution and presets
35
46
 
36
- `cookbook()` and CLI commands discover the same `docs.config.ts`. Set `root`
37
- to a directory relative to this file to change where content, local assets,
38
- and the lock live. `--root` chooses the CLI's configuration search directory;
39
- `--config` chooses a config file. An inline integration `config` object skips
40
- discovery and resolves its `root` relative to the integration root.
47
+ `cookbook()` and CLI commands discover the same configuration file:
48
+ `docs.config.ts`, `.mts`, `.js`, or `.mjs`, in that order. Set `root` to a
49
+ directory relative to this file to change where content, local assets, and
50
+ `cookbook.lock.json` live. For a nonstandard location, use
51
+ `cookbook({ configFile: "./config/manual.ts" })` and
52
+ `cookbook doctor --config ./config/manual.ts`. Because `root` resolves from the
53
+ configuration file's directory, that file needs `root: ".."` to keep reading
54
+ `README.md` and `docs/` from the app directory. `--root` chooses the CLI's
55
+ project directory. An inline integration `config` object skips discovery and
56
+ resolves its `root` relative to the integration root; `configFile: false`
57
+ disables discovery.
41
58
 
42
59
  Use `mergeDocsConfig(preset, overrides)` to compose shared configuration. Objects
43
- merge recursively and arrays replace. Each `theme.fonts` role replaces its
44
- previous definition, so switching a role from Google to local files takes one
60
+ merge recursively and arrays replace. Each `theme.brand`, `theme.palette` role,
61
+ `theme.fonts` role, `site.logo`, and `site.seo.image` replaces its previous
62
+ definition, so switching a font role from Google to local files takes one
45
63
  override. Tasty styles preserve default values when adding conditional
46
64
  overrides. Neither input is mutated. See
47
- [working examples](./examples.md#share-configuration-and-themes).
48
-
49
- ## Redirects
50
-
51
- Map old routes to collected document routes:
52
-
53
- ```ts
54
- redirects: { "/old-guide": "/getting-started" }
55
- ```
56
-
57
- Pages can also declare `aliases: ["/old-guide"]` in frontmatter. Page aliases are
58
- relative to the source mount. Cookbook rejects collisions, cycles, and missing
59
- targets, collapses chains, and lets Astro emit static redirects. Internal links
60
- using an alias are rewritten to the canonical route.
65
+ [shared themes](./recipes.md#share-configuration-and-themes).
61
66
 
62
67
  ## Site
63
68
 
@@ -103,8 +108,15 @@ content: {
103
108
  },
104
109
  ```
105
110
 
106
- Each `routeBase` must have a home page (a localized home also qualifies), and version roots must be distinct. A
107
- single-version site can continue using `site.version` for a simple label.
111
+ `site.versions` needs at least two entries. Each `routeBase` must have a
112
+ non-draft home page (a localized home also qualifies), and version roots must
113
+ be distinct. A single-version site can continue using `site.version` for a
114
+ simple label. Set `index: false` on a version to keep it out of search engines;
115
+ see [publishing metadata](./publishing.md#versions-locales-and-canonical-urls).
116
+
117
+ `site.seo` controls title templates, social preview images, indexing,
118
+ breadcrumbs, and page Markdown downloads. See
119
+ [publishing metadata](./publishing.md) for every field.
108
120
 
109
121
  ### Site logo
110
122
 
@@ -112,10 +124,37 @@ single-version site can continue using `site.version` for a simple label.
112
124
  with `src` (one image) or `light` and `dark` (appearance variants). Optional
113
125
  `alt`, `decorative`, `href`, `width`, and `height` control accessible text,
114
126
  destination, and intrinsic sizing. It applies to the header and mobile drawer.
115
- See the [shared logo guide](./custom-components.md#a-shared-site-logo).
127
+ See the [logo guide](./theme-and-components.md#logo-and-favicon).
116
128
  The logo and favicon are independent.
117
129
 
118
- ## Site icons
130
+ ### Header links
131
+
132
+ Configure the top bar with `site.headerLinks`. Links appear beside search on
133
+ larger screens and in a More popover below 50rem. The desktop header supports
134
+ primary buttons; More uses a compact, left-aligned list of uniform navigation
135
+ links. Omit the array (or use `[]`) to hide More.
136
+
137
+ ```ts
138
+ site: {
139
+ headerLinks: [
140
+ {
141
+ label: "Changelog",
142
+ link: "https://example.com/changelog",
143
+ newTab: true,
144
+ },
145
+ { label: "Get started", link: "/getting-started", variant: "primary" },
146
+ ],
147
+ },
148
+ ```
149
+
150
+ Each entry requires a non-empty `label` and a `link` (an HTTP(S) URL,
151
+ root-relative route, or fragment). Cookbook prefixes root-relative links with
152
+ the Astro base. `variant` is `default` or `primary` and applies on desktop;
153
+ `newTab` defaults to false
154
+ and adds safe new-window attributes when enabled. Customize the complete
155
+ button and popover style tree through `theme.styles.HeaderLinks`.
156
+
157
+ ### Site icons
119
158
 
120
159
  Cookbook ships its book mark as the default favicon. Set `site.favicon` to a
121
160
  local SVG, PNG, JPEG, WebP, AVIF, or GIF when the documentation should use the
@@ -174,9 +213,9 @@ string `content`. Cookbook renders these entries directly as HTML elements;
174
213
  they do not pass through Astro's script or style processing. Use a `Head`
175
214
  component override when a local asset needs Astro processing.
176
215
 
177
- ## Page metadata
216
+ ## Edit links and timestamps
178
217
 
179
- Enable source-aware edit links and Git timestamps for the page footer:
218
+ Enable edit links and Git timestamps for the page footer:
180
219
 
181
220
  ```ts
182
221
  editLink: {
@@ -185,23 +224,45 @@ editLink: {
185
224
  lastUpdated: true,
186
225
  ```
187
226
 
188
- Cookbook joins `editLink.baseUrl` with each original repository-relative source
189
- path, not a generated content-collection path. Set `editUrl: false` or
190
- `lastUpdated: false` in a page's frontmatter to opt that page out; a string
191
- `editUrl` or date-valued `lastUpdated` overrides the generated value. Package
192
- sources show a timestamp only when their materialized file has Git history or
227
+ Cookbook joins `editLink.baseUrl` with each page's source path relative to the
228
+ Cookbook `root`, or to the source's own `root` when it lies outside. If `root`
229
+ is not the repository root, include the subdirectory in `baseUrl`. Set
230
+ `editUrl: false` or `lastUpdated: false` in a page's frontmatter to opt that
231
+ page out; a string `editUrl` or date-valued `lastUpdated` overrides the
232
+ generated value. Package pages come from an npm artifact rather than your
233
+ repository, so they show an edit link only when their own frontmatter sets
234
+ `editUrl`, and a timestamp only when their materialized file has Git history or
193
235
  the page supplies one explicitly.
194
236
 
195
- These settings use Cookbook's original source paths when constructing links and
196
- timestamps.
197
-
198
- Cookbook also accepts page presentation frontmatter:
237
+ ## Page frontmatter
238
+
239
+ Pages accept these frontmatter fields:
240
+
241
+ | Field | Purpose |
242
+ | ----------------- | --------------------------------------------------------------------------------------------- |
243
+ | `title` | Page title; defaults to the source declaration's title, then the first heading, then the file |
244
+ | `description` | Meta description and `llms.txt` summary |
245
+ | `slug` | Route relative to the source's `routeBase`; see [content sources](./content-sources.md) |
246
+ | `aliases` | Old routes that redirect to this page; see [redirects](#redirects) |
247
+ | `draft` | Publish at its URL but omit from discovery; see [draft pages](#draft-pages) |
248
+ | `sidebar` | `false`, or `label`, `order`, `group`, and `badge` for generated sidebars |
249
+ | `tableOfContents` | `false`, or `mobile`, `minHeadingLevel`, and `maxHeadingLevel` |
250
+ | `template` | `doc` (default) or `splash` for a wide layout without sidebars |
251
+ | `hero` | `title`, `tagline`, `image`, and `actions` for a page hero |
252
+ | `banner` | `content` for a notice above the page |
253
+ | `prev`, `next` | `false` to hide, a route, or `{ link, label }` to replace the pagination link |
254
+ | `editUrl` | `false` or an explicit edit URL |
255
+ | `lastUpdated` | `false` or an explicit date |
256
+ | `pagefind` | `false` to omit the page from search |
257
+ | `head` | Extra `<head>` entries for this page, in the same shape as [`head`](#head) |
258
+ | `seo` | Page title, image, canonical, indexing, and breadcrumbs; see [publishing](./publishing.md) |
259
+
260
+ For example:
199
261
 
200
262
  ```yaml
201
263
  tableOfContents:
202
264
  minHeadingLevel: 2
203
265
  maxHeadingLevel: 4
204
- pagefind: true
205
266
  banner:
206
267
  content: This API is experimental.
207
268
  hero:
@@ -220,16 +281,19 @@ sidebar:
220
281
  Set `sidebar: false` to omit a page from generated sidebars. `label`, `order`,
221
282
  `group`, and `badge` affect both the default sidebar and autogenerated navigation
222
283
  directories. A badge is plain text and also appears when a navigation item links
223
- to the page, unless that item overrides it. Relative hero images are validated, content-hashed, and copied
224
- with the page's other local assets. Unrecognized frontmatter is preserved as graph entry `metadata`, outside the
225
- renderer frontmatter. Use `content.frontmatter: "reject"` to reject unrelated
226
- fields. Other supported fields include `aliases`, `template`, `hero`, `editUrl`,
227
- `lastUpdated`, `prev`, `next`, `head`, `draft`, and `slug`.
284
+ to the page, unless that item overrides it. Relative hero images are validated,
285
+ content-hashed, and copied with the page's other local assets; see
286
+ [hero images](./authoring.mdx#hero-images).
228
287
 
229
288
  Set `pagefind: false` to omit an individual published page from search while
230
289
  keeping its normal route and navigation. A draft is excluded from search
231
290
  regardless of `pagefind`.
232
291
 
292
+ Unrecognized frontmatter is preserved as graph entry `metadata`, outside the
293
+ renderer frontmatter. Use `content.frontmatter: "reject"` to reject unrelated
294
+ fields, or validate custom fields with a
295
+ [frontmatter schema](./plugins.md#custom-frontmatter).
296
+
233
297
  ### Draft pages
234
298
 
235
299
  Set `draft: true` to publish a page for review at its normal URL. Drafts remain
@@ -238,6 +302,20 @@ They are excluded from automatic navigation, pagination, search, sitemaps, and
238
302
  `llms.txt`, and receive `noindex` metadata. Removing `draft` makes the page
239
303
  discoverable on the next build. A draft URL is public; this is not access control.
240
304
 
305
+ ## Table of contents
306
+
307
+ Desktop pages show an on-page table of contents for heading levels 2 and 3.
308
+ Set site-wide defaults with the top-level `tableOfContents` key:
309
+
310
+ ```ts
311
+ tableOfContents: { mobile: true, minHeadingLevel: 2, maxHeadingLevel: 3 }
312
+ ```
313
+
314
+ `mobile: true` adds a compact contents disclosure below the header on smaller
315
+ screens; it defaults to `false`. Heading levels accept 1 through 6. A page's
316
+ `tableOfContents` frontmatter overrides these values, and `false` hides both
317
+ lists. See [on-page navigation](./authoring.mdx#on-page-navigation).
318
+
241
319
  ## Languages
242
320
 
243
321
  Configure Cookbook's multilingual routing and language picker:
@@ -264,6 +342,67 @@ links use the same policy, so a missing `/fr/` never creates a broken home link.
264
342
  Alternate-language metadata lists only existing published translations. Drafts
265
343
  remain directly accessible but are excluded from locale discovery.
266
344
 
345
+ ## Translations
346
+
347
+ Cookbook includes English and French interface messages. Other languages use
348
+ English for missing messages. Override messages by language code; regional codes fall back to the
349
+ base language and then English:
350
+
351
+ ```ts
352
+ translations: {
353
+ de: {
354
+ appearance: "Darstellung",
355
+ closeNavigation: "Navigation schließen",
356
+ "navigation.Guide": "Anleitung",
357
+ },
358
+ },
359
+ ```
360
+
361
+ `navigation.<configured label>` translates tab, group, and labeled-link
362
+ labels, `site.headerLinks` labels, and explicitly configured sidebar badges.
363
+ Automatically generated links use the title from the translated page.
364
+ The supported keys below keep independent overrides, including similar labels:
365
+ `auto` controls contrast, while `themeSelect.auto` controls color scheme;
366
+ `search.label` labels the search control, while `pagefind.search` supplies the
367
+ search input prompt. No migration or key renaming is needed.
368
+
369
+ | Keys | Controls or feedback |
370
+ | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
371
+ | `copyPage`, `viewMarkdown`, `pageCopied`, `pageCopyError` | Page Markdown actions and copy status. |
372
+ | `draftTitle`, `draftNotice` | Draft-page notice. |
373
+ | `searchError` | Search loading failure. |
374
+ | `appearance`, `colorScheme`, `contrast`, `normalContrast`, `highContrast`, `auto` | Appearance and contrast controls. |
375
+ | `closeNavigation`, `primary`, `sections`, `chooseSection` | Primary and mobile navigation. |
376
+ | `headerLinks`, `more`, `closeMore`, `moreLinks` | Header links and overflow menu. |
377
+ | `versions`, `documentationVersion`, `documentationVersions`, `version` | Version selection and package labels. |
378
+ | `home`, `generatedWith`, `viewSource` | Home, footer credit and preview source. |
379
+ | `copyCode`, `codeCopied`, `codeCopyError` | Code copy action and status. |
380
+ | `copyHeading`, `linkCopied`, `linkCopyError` | Heading link action and status. Preserve `{heading}` in `copyHeading`. |
381
+ | `notFound`, `notFoundDescription`, `fallback` | Missing-page and language fallback messages. |
382
+ | `sidebarNav.accessibleLabel`, `menuButton.accessibleLabel` | Sidebar navigation and menu accessible names. |
383
+ | `tableOfContents.onThisPage`, `languageSelect.accessibleLabel` | Contents heading and language selector. |
384
+ | `themeSelect.light`, `themeSelect.dark`, `themeSelect.auto` | Color-scheme options. |
385
+ | `search.label`, `search.ctrlKey`, `search.cancelLabel`, `search.devWarning` | Search control, shortcut, close action and development notice. |
386
+ | `page.nextLink`, `page.previousLink`, `page.editLink`, `page.lastUpdated`, `page.skipToContent` | Pagination, edit/update labels and skip link. |
387
+ | `pagefind.search`, `pagefind.clear_search`, `pagefind.zero_results`, `pagefind.many_results`, `pagefind.one_result` | Search input, clearing and result counts. Preserve `[COUNT]` in count messages. |
388
+
389
+ Custom component message keys are also preserved. Missing custom keys passed to
390
+ `Astro.locals.t(key)` return the key itself. Changing an override does not alter
391
+ other message keys, even when their default text is the same.
392
+
393
+ ## Redirects
394
+
395
+ Map old routes to collected document routes:
396
+
397
+ ```ts
398
+ redirects: { "/old-guide": "/getting-started" }
399
+ ```
400
+
401
+ Pages can also declare `aliases: ["/old-guide"]` in frontmatter. Page aliases are
402
+ relative to the source mount. Cookbook rejects collisions, cycles, and missing
403
+ targets, collapses chains, and lets Astro emit static redirects. Internal links
404
+ using an alias are rewritten to the canonical route.
405
+
267
406
  ## Content
268
407
 
269
408
  ```ts
@@ -287,7 +426,8 @@ and each package manifest's `repository` metadata for package sources.
287
426
  ## Navigation
288
427
 
289
428
  Navigation can mix direct routes, nested groups, autogenerated directories,
290
- and external links. Groups are recursive and can be nested to any practical
429
+ and external links. `navigation` may be an array, as shorthand for
430
+ `navigation.items`. Groups are recursive and can be nested to any practical
291
431
  depth. Use the object form to add an optional primary tab row above the
292
432
  documentation shell:
293
433
 
@@ -363,7 +503,7 @@ also appears in the manual list or autogenerated directory. It remains in
363
503
  previous/next page navigation. A group with no remaining children becomes a
364
504
  regular page link.
365
505
 
366
- Every navigation object, including manual and autogenerated groups, accepts a
506
+ Every navigation item, including manual and autogenerated groups, accepts a
367
507
  plain-text `badge`, such as `{ label: "Offline support", link: "/offline-support",
368
508
  badge: "NEW" }`. Links inherit `sidebar.badge` from their page's frontmatter;
369
509
  an explicit `badge` overrides it, and `badge: ""` hides it. Badges use brand-derived
@@ -392,7 +532,7 @@ fallback. Every internal route named anywhere in navigation must exist.
392
532
  theme: {
393
533
  brand: {
394
534
  from: "#2f5bff",
395
- contrast: { apca: [45, 60] }
535
+ contrast: { apca: [80, 95] }
396
536
  },
397
537
  palette: {
398
538
  surface: { tone: 98, saturation: 0.05 },
@@ -476,14 +616,32 @@ surface's complete base object internally. Unknown built-in names and sub-elemen
476
616
  component names and their overrides in `theme.customStyles`. Structural Astro overrides under
477
617
  `components.overrides` remain available when styling alone is insufficient.
478
618
  `theme.states` registers additional Tasty state shorthands or replaces a
479
- built-in alias; see the [responsive state reference](./component-styles.md#responsive-states)
480
- for all nine defaults. `contrastLevel` is forwarded to Glaze's palette
481
- resolution.
619
+ built-in alias; see the [state reference](./component-styles.md#states-in-style-maps)
620
+ for the built-in responsive, appearance, motion, and prose aliases.
621
+ `contrastLevel` accepts `"auto"` or a number from 0 to 100 and is forwarded to
622
+ Glaze's palette resolution.
482
623
  The built-in documentation navigation surfaces are available as `Sidebar`,
483
- `TableOfContents`, `MobileMenuToggle`, and `MobileNavigationTabs`; see
484
- [Component styles](./component-styles.md#style-customization) for their
624
+ `TopNavigation`, `TableOfContents`, `MobileMenuToggle`, and
625
+ `MobileNavigationTabs`; see
626
+ [Component styles](./component-styles.md#complete-component-anatomy) for their
485
627
  complete sub-element lists.
486
628
 
629
+ The theme also accepts these fields, documented in their guides:
630
+
631
+ | Field | Guide |
632
+ | ------------------ | ------------------------------------------------------------------------------ |
633
+ | `glaze` | [Glaze adaptation](./theme-and-components.md#configure-glaze-adaptation) |
634
+ | `units`, `recipes` | [Units and recipes](./theme-and-components.md#register-units-and-recipes) |
635
+ | `fontLoading` | [Font loading and caching](./fonts-and-typography.md#font-loading-and-caching) |
636
+ | `customStyles` | [Custom components](./custom-components.md) |
637
+
638
+ `theme.palette.header` sets the translucent header's color declaration. It defaults
639
+ to `theme.palette.surface`; Glaze resolves it for light, dark, and both high
640
+ contrast modes. Adjust blur and other header styling via `theme.styles.HeaderFrame`.
641
+ `theme.palette.overlay` controls the drawer underlay color, defaulting to black
642
+ at 50% opacity in every scheme. The mobile drawer uses the Glaze shadow token and
643
+ a 120ms slide transition; customize these through `theme.styles.Sidebar`.
644
+
487
645
  ## Markdown
488
646
 
489
647
  ```ts
@@ -569,8 +727,12 @@ components: {
569
727
  Component replacement is the advanced escape hatch. Prefer theme tokens and
570
728
  named styles for visual changes that do not need new structure.
571
729
 
572
- Cookbook uses these Astro component slots. A relative override path resolves
573
- from the project root; a package specifier resolves from the app's dependencies:
730
+ Cookbook uses these Astro component slots and rejects other names. A path
731
+ starting with `.` resolves from the Astro project directory, where
732
+ `astro.config` lives, and an absolute path is used as is. Any other value is
733
+ resolved as a package specifier from the app's dependencies, so write
734
+ `./src/Header.astro` rather than `src/Header.astro`. `cookbook doctor` checks
735
+ each path the same way:
574
736
 
575
737
  | Area | Override names |
576
738
  | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -618,91 +780,8 @@ missing heading fragments errors and defaults to `true` when `CI=true`.
618
780
  Cookbook derives its public base path from Astro's top-level `base` setting so
619
781
  routes and assets cannot drift between two configurations. Page URLs likewise
620
782
  follow Astro's `trailingSlash` and `build.format`; see
621
- [Deployment](./deployment.md#github-pages). An empty `cacheDir`
783
+ [Deployment](./deployment.md#public-url-and-base-path). An empty `cacheDir`
622
784
  uses `~/.cache/cookbook`; set an explicit path to relocate downloaded package
623
- artifacts. Package limits protect builds from unexpected registry artifacts;
624
- raise them deliberately for a reviewed package.
625
-
626
- ## Header buttons
627
-
628
- Configure the top bar with `site.headerLinks`. Links appear beside search on
629
- larger screens and in a More popover below 50rem. The desktop header supports
630
- primary buttons; More uses a compact, left-aligned list of uniform navigation
631
- links. Omit the array (or use `[]`) to hide More.
632
-
633
- ```ts
634
- export default defineDocsConfig({
635
- site: {
636
- headerLinks: [
637
- {
638
- label: "Changelog",
639
- link: "https://example.com/changelog",
640
- newTab: true,
641
- },
642
- { label: "Get started", link: "/getting-started", variant: "primary" },
643
- ],
644
- },
645
- });
646
- ```
647
-
648
- Each entry requires a non-empty `label` and a `link` (an HTTP(S) URL,
649
- root-relative route, or fragment). Cookbook prefixes root-relative links with
650
- the Astro base. `variant` is `default` or `primary` and applies on desktop;
651
- `newTab` defaults to false
652
- and adds safe new-window attributes when enabled. Customize the complete
653
- button and popover style tree through `theme.styles.HeaderLinks`.
654
-
655
- `theme.palette.header` sets the translucent header's color declaration. It defaults
656
- to `theme.palette.surface`; Glaze resolves it for light, dark, and both high
657
- contrast modes. Adjust blur and other header styling via `theme.styles.HeaderFrame`.
658
- `theme.palette.overlay` controls the fixed underlay color, defaulting to black at
659
- 50% opacity in every scheme. The mobile drawer uses the Glaze shadow token and
660
- a 120ms slide transition; customize these through `theme.styles.Sidebar`.
661
-
662
- ### Translate Cookbook controls
663
-
664
- Cookbook includes English and French interface messages. Other languages use
665
- English for missing messages. Override messages by language code; regional codes fall back to the
666
- base language and then English:
667
-
668
- ```ts
669
- translations: {
670
- de: {
671
- appearance: "Darstellung",
672
- closeNavigation: "Navigation schließen",
673
- "navigation.Guide": "Anleitung",
674
- },
675
- },
676
- ```
677
-
678
- `navigation.<configured label>` translates named tabs, navigation groups, and
679
- explicitly configured sidebar badges.
680
- Automatically generated links use the title from the translated page.
681
- The supported keys below keep independent overrides, including similar labels:
682
- `auto` controls contrast, while `themeSelect.auto` controls color scheme;
683
- `search.label` labels the search control, while `pagefind.search` supplies the
684
- search input prompt. No migration or key renaming is needed.
685
-
686
- | Keys | Controls or feedback |
687
- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
688
- | `copyPage`, `viewMarkdown`, `pageCopied`, `pageCopyError` | Page Markdown actions and copy status. |
689
- | `draftTitle`, `draftNotice` | Draft-page notice. |
690
- | `searchError` | Search loading failure. |
691
- | `appearance`, `colorScheme`, `contrast`, `normalContrast`, `highContrast`, `auto` | Appearance and contrast controls. |
692
- | `closeNavigation`, `primary`, `sections`, `chooseSection` | Primary and mobile navigation. |
693
- | `headerLinks`, `more`, `closeMore`, `moreLinks` | Header links and overflow menu. |
694
- | `versions`, `documentationVersion`, `documentationVersions`, `version` | Version selection and package labels. |
695
- | `home`, `generatedWith`, `viewSource` | Home, footer credit and preview source. |
696
- | `copyCode`, `codeCopied`, `codeCopyError` | Code copy action and status. |
697
- | `copyHeading`, `linkCopied`, `linkCopyError` | Heading link action and status. Preserve `{heading}` in `copyHeading`. |
698
- | `notFound`, `notFoundDescription`, `fallback` | Missing-page and language fallback messages. |
699
- | `sidebarNav.accessibleLabel`, `menuButton.accessibleLabel` | Sidebar navigation and menu accessible names. |
700
- | `tableOfContents.onThisPage`, `languageSelect.accessibleLabel` | Contents heading and language selector. |
701
- | `themeSelect.light`, `themeSelect.dark`, `themeSelect.auto` | Color-scheme options. |
702
- | `search.label`, `search.ctrlKey`, `search.cancelLabel`, `search.devWarning` | Search control, shortcut, close action and development notice. |
703
- | `page.nextLink`, `page.previousLink`, `page.editLink`, `page.lastUpdated`, `page.skipToContent` | Pagination, edit/update labels and skip link. |
704
- | `pagefind.search`, `pagefind.clear_search`, `pagefind.zero_results`, `pagefind.many_results`, `pagefind.one_result` | Search input, clearing and result counts. Preserve `[COUNT]` in count messages. |
705
-
706
- Custom component message keys are also preserved. Missing custom keys passed to
707
- `Astro.locals.t(key)` return the key itself. Changing an override does not alter
708
- other message keys, even when their default text is the same.
785
+ artifacts. The artifact, unpacked-size, file-count, and path-depth limits protect builds
786
+ from unexpected registry artifacts; raise them deliberately for a reviewed
787
+ package. `maxAssetBytes` also caps each local asset and OpenAPI document.
@@ -54,17 +54,24 @@ Use a glob for a documentation tree:
54
54
  directory `README.md` or `index.md` maps to the directory route; other pages
55
55
  use extensionless routes.
56
56
 
57
- | Source path | `base` | `routeBase` | Route |
58
- | -------------------- | ------ | ------------ | ---------------------------- |
59
- | `README.md` | — | — | `/` when explicitly assigned |
60
- | `docs/setup.md` | `docs` | — | `/setup` |
61
- | `docs/api/index.md` | `docs` | — | `/api` |
62
- | `docs/api/client.md` | `docs` | `/reference` | `/reference/api/client` |
63
-
64
- Source paths are resolved from the configured project root. Paths outside that
65
- root are rejected unless `content.allowOutsideRoot` is explicitly enabled.
66
- Prefer an explicit source `root` when documenting another package; file and
67
- glob paths, links, and assets are confined to that declared source root.
57
+ | Source path | `base` | `routeBase` | Route |
58
+ | -------------------- | ------ | ------------ | ----------------------- |
59
+ | `README.md` | — | — | `/` |
60
+ | `docs/setup.md` | `docs` | — | `/setup` |
61
+ | `docs/api/index.md` | `docs` | — | `/api` |
62
+ | `docs/api/client.md` | `docs` | `/reference` | `/reference/api/client` |
63
+
64
+ Source paths resolve from the source's `root`, which defaults to the project
65
+ root. A file or glob match outside that source root is rejected unless
66
+ `content.allowOutsideRoot` is explicitly enabled. Prefer an explicit source
67
+ `root` when documenting another package; file and glob paths, links, and assets
68
+ are confined to that declared source root, which may itself lie outside the
69
+ project root.
70
+
71
+ File sources accept `navigation: false` or a `{ label, order, group, badge }`
72
+ placement, used when the page's frontmatter has no `sidebar`. Glob sources
73
+ accept `navigation: false` to keep every matched page out of generated
74
+ sidebars.
68
75
 
69
76
  ## Source identities and repeated mounts
70
77
 
@@ -77,7 +84,7 @@ content: {
77
84
  sources: [
78
85
  { id: "v1", root: "versions/v1", glob: "**/*.md", routeBase: "/v1" },
79
86
  { id: "v2", root: "versions/v2", glob: "**/*.md", routeBase: "/v2" },
80
- ];
87
+ ],
81
88
  }
82
89
  ```
83
90
 
@@ -90,7 +97,8 @@ fragments are preserved.
90
97
  A frontmatter `slug` is relative to `routeBase`, including when it begins with
91
98
  `/`. For example, `slug: intro` under `/v2` creates `/v2/intro`. File sources also
92
99
  accept `routeBase`, which prefixes their explicit `route`. Empty `sources: []`
93
- means no sources; omit the property to enable conventions.
100
+ means no sources, so the build fails with no pages; omit the property to enable
101
+ conventions.
94
102
 
95
103
  ## OpenAPI references
96
104
 
@@ -106,7 +114,7 @@ content: {
106
114
  }
107
115
  ```
108
116
 
109
- The overview appears at `/api`. An operation with `operationId: getWidget`
117
+ `routeBase` defaults to `/api`, so the overview appears at `/api`. An operation with `operationId: getWidget`
110
118
  appears at `/api/get-widget`. Without an operation ID, Cookbook derives a route
111
119
  from its method and path. Operation IDs must create distinct routes. The pages
112
120
  include parameters, request bodies, responses, examples, and the document's
@@ -160,15 +168,22 @@ Package sources read documentation from the actual npm artifact:
160
168
  }
161
169
  ```
162
170
 
171
+ Without `include`, Cookbook reads the package's `package.json` `cookbook.include`
172
+ patterns (default `docs/**/*.{md,mdx}`) and `cookbook.exclude`. The home page is
173
+ `index`, then the package's `cookbook.index`, then `README.md`, and it maps to
174
+ `routeBase`. Other pages drop a leading `docs/`, so `docs/guide.md` becomes
175
+ `/guide`.
176
+
163
177
  Run `cookbook update` to create or reconcile the lock after editing sources.
164
- A production build uses the exact requested specifier, version, and integrity stored in
165
- `cookbook.lock.json`. The package creator writes this lock automatically.
178
+ Every build and development server uses the exact requested specifier, version,
179
+ and integrity stored in `cookbook.lock.json`. The project creator writes this
180
+ lock automatically when you start with `--package`.
166
181
  Artifacts are integrity-checked, extracted with file-count and size limits,
167
182
  and cached by integrity.
168
183
 
169
184
  Package Markdown is untrusted by default. Raw HTML is sanitized to safe
170
185
  elements, HTML-capable frontmatter is stripped, custom `head` entries are discarded,
171
- unsafe URL protocols are rejected, and MDX cannot execute. Set `trust: "mdx"`
186
+ and MDX cannot execute. Set `trust: "mdx"`
172
187
  only after reviewing the exact locked artifact; doing so allows its build-time
173
188
  code to run. Trusted MDX is compiled by Astro, including relative component
174
189
  imports from the source file's directory. Package-provided indexes, include
@@ -177,7 +192,8 @@ extracted artifact root.
177
192
 
178
193
  ## Links and assets
179
194
 
180
- Write ordinary repository-relative Markdown:
195
+ Write ordinary file-relative Markdown links. A root-relative link such as
196
+ `/guide` is checked against collected routes:
181
197
 
182
198
  ```md
183
199
  [Install](./getting-started.md)
@@ -195,10 +211,12 @@ default. Set `content.localizeRepositoryLinks: true` to rewrite absolute links
195
211
  back into the collected documentation when they match `site.repository` or the
196
212
  current package's `repository` manifest field. GitHub/GitLab `blob`, `tree`, and
197
213
  `raw` URLs plus Bitbucket `src` URLs are recognized; query strings and fragments
198
- are preserved. Links without a matching collected page remain external.
214
+ are preserved. Only pages from the same source root as the linking page are
215
+ matched; links without a matching collected page remain external.
199
216
 
200
- Missing relative links are errors in strict mode; missing assets and paths
201
- escaping an allowed source root are always errors.
217
+ Missing relative links are errors in strict mode; missing assets, paths
218
+ escaping an allowed source root, and unsafe URL protocols such as `javascript:`
219
+ are always errors.
202
220
 
203
221
  Run the [doctor command](./cli.md#validate-with-doctor) before committing a
204
222
  large content move.