@tenphi/cookbook 0.28.0 → 0.30.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 +13 -11
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/docs/ai-agents.md +5 -3
- package/docs/architecture.md +10 -7
- package/docs/authoring.mdx +94 -36
- package/docs/cli.md +92 -33
- package/docs/component-styles.md +286 -282
- package/docs/configuration.md +232 -153
- package/docs/content-sources.md +39 -21
- package/docs/custom-components.md +117 -169
- package/docs/customization-rules.md +23 -14
- package/docs/deployment.md +101 -53
- package/docs/es/getting-started.md +7 -5
- package/docs/es/index.md +1 -1
- package/docs/examples.md +65 -28
- package/docs/fonts-and-typography.md +32 -27
- package/docs/getting-started.md +17 -10
- package/docs/ja/getting-started.md +7 -5
- package/docs/ja/index.md +1 -1
- package/docs/migration.md +188 -65
- package/docs/plugins.md +28 -16
- package/docs/publishing.md +3 -2
- package/docs/quality-checks.md +18 -42
- package/docs/recipes.md +38 -54
- package/docs/ru/getting-started.md +7 -5
- package/docs/ru/index.md +1 -1
- package/docs/site-navigation.md +47 -47
- package/docs/theme-and-components.md +126 -59
- package/docs/troubleshooting.md +4 -3
- package/docs/upstream/manifest.json +2 -2
- package/docs/upstream/tasty/README.md +404 -381
- package/docs/upstream/tasty/docs/README.md +4 -1
- package/docs/upstream/tasty/docs/adoption.md +25 -17
- package/docs/upstream/tasty/docs/ai-agents.md +42 -34
- package/docs/upstream/tasty/docs/comparison.md +9 -8
- package/docs/upstream/tasty/docs/configuration.md +187 -69
- package/docs/upstream/tasty/docs/debug.md +3 -2
- package/docs/upstream/tasty/docs/design-system.md +117 -15
- package/docs/upstream/tasty/docs/dsl.md +211 -117
- package/docs/upstream/tasty/docs/getting-started.md +81 -24
- package/docs/upstream/tasty/docs/injector.md +41 -40
- package/docs/upstream/tasty/docs/methodology.md +46 -21
- package/docs/upstream/tasty/docs/migration-v3.md +3 -3
- package/docs/upstream/tasty/docs/pipeline.md +111 -116
- package/docs/upstream/tasty/docs/plugins.md +21 -41
- package/docs/upstream/tasty/docs/react-api.md +73 -10
- package/docs/upstream/tasty/docs/runtime-benchmarks.md +46 -46
- package/docs/upstream/tasty/docs/ssr.md +92 -66
- package/docs/upstream/tasty/docs/styles.md +37 -17
- package/docs/upstream/tasty/docs/tasty-static.md +175 -57
- package/docs/zh/getting-started.md +7 -5
- package/docs/zh/index.md +1 -1
- package/package.json +3 -3
package/docs/plugins.md
CHANGED
|
@@ -22,13 +22,15 @@ export default defineConfig({
|
|
|
22
22
|
});
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
+
Install `@astrojs/markdown-remark` first; it is an optional Astro dependency
|
|
26
|
+
that generated projects do not include. Astro's default Sätteri processor does
|
|
27
|
+
not run remark or rehype plugins. Cookbook adds its transforms to whichever
|
|
28
|
+
processor is configured, and `.mdx` pages use the same processor.
|
|
29
|
+
|
|
25
30
|
## GitHub alerts
|
|
26
31
|
|
|
27
32
|
Cookbook renders GitHub alert blockquotes in Markdown and MDX without an extra
|
|
28
|
-
plugin
|
|
29
|
-
note, tip, caution, and danger surfaces. For example:
|
|
30
|
-
|
|
31
|
-
The default Astro integration is sufficient for alert rendering:
|
|
33
|
+
plugin; the default Astro integration is enough:
|
|
32
34
|
|
|
33
35
|
```js cookbook-verify=github-alerts
|
|
34
36
|
import cookbook from "@tenphi/cookbook";
|
|
@@ -43,22 +45,29 @@ Write the alert in a Markdown or MDX page:
|
|
|
43
45
|
> Keep source documentation next to the code it describes.
|
|
44
46
|
```
|
|
45
47
|
|
|
48
|
+
`NOTE` renders as a note, `TIP` and `IMPORTANT` as a tip, `WARNING` as a
|
|
49
|
+
caution, and `CAUTION` as danger. Titles are English. Alerts use the same
|
|
50
|
+
status palette roles as `Callout`: `info` for notes, `success` for tips,
|
|
51
|
+
`warning` for cautions, and `danger` for danger.
|
|
52
|
+
|
|
46
53
|
Customize the result through `theme.styles.MarkdownAlert`. Its named
|
|
47
|
-
sub-elements are `
|
|
48
|
-
`
|
|
54
|
+
sub-elements are `Title` and `FirstContent`. Style each kind with root states
|
|
55
|
+
such as `[data-note]`, `[data-tip]`, `[data-caution]`, and `[data-danger]` in
|
|
56
|
+
property state maps.
|
|
49
57
|
|
|
50
58
|
## Custom frontmatter
|
|
51
59
|
|
|
52
|
-
|
|
53
|
-
`content.frontmatter: "preserve"
|
|
54
|
-
`frontmatterSchema`:
|
|
60
|
+
Cookbook keeps unknown frontmatter fields as JSON metadata by default
|
|
61
|
+
(`content.frontmatter: "preserve"`); `"reject"` turns them into errors.
|
|
62
|
+
Validate or add custom fields with `frontmatterSchema`:
|
|
55
63
|
|
|
56
64
|
```ts
|
|
57
65
|
export default defineConfig({
|
|
58
66
|
integrations: [
|
|
59
67
|
cookbook({
|
|
60
68
|
frontmatterSchema: {
|
|
61
|
-
parse(
|
|
69
|
+
parse(value) {
|
|
70
|
+
const metadata = value as Record<string, unknown>;
|
|
62
71
|
return { ...metadata, owner: metadata.owner ?? "maintainers" };
|
|
63
72
|
},
|
|
64
73
|
},
|
|
@@ -67,9 +76,11 @@ export default defineConfig({
|
|
|
67
76
|
});
|
|
68
77
|
```
|
|
69
78
|
|
|
70
|
-
The schema receives only custom metadata
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
The schema receives only custom metadata and may provide `parse` or
|
|
80
|
+
`parseAsync`, so a Zod schema works directly. The returned object is merged
|
|
81
|
+
over the original metadata, so fields the schema omits are kept. It cannot set
|
|
82
|
+
route, title, draft, or other reserved page fields. Returned values must be
|
|
83
|
+
JSON-safe because the renderer passes them through a build-time virtual module.
|
|
73
84
|
|
|
74
85
|
## Read the content graph
|
|
75
86
|
|
|
@@ -85,9 +96,10 @@ const visiblePages = getCookbookCollection();
|
|
|
85
96
|
const guide = getCookbookEntry("/guide");
|
|
86
97
|
```
|
|
87
98
|
|
|
88
|
-
Queries return snapshots. Drafts are omitted from the collection
|
|
89
|
-
`getCookbookEntry()` can
|
|
90
|
-
|
|
99
|
+
Queries return snapshots. Drafts are omitted from the collection unless you
|
|
100
|
+
call `getCookbookCollection({ includeDrafts: true })`; `getCookbookEntry()` can
|
|
101
|
+
retrieve one by its exact route. The same API is available at
|
|
102
|
+
`@tenphi/renderer/content` for renderer-only projects.
|
|
91
103
|
|
|
92
104
|
Component overrides receive page data from `Astro.locals.cookbookRoute`,
|
|
93
105
|
including the current entry, locale, navigation, table of contents, and head
|
package/docs/publishing.md
CHANGED
|
@@ -116,8 +116,9 @@ them as duplicates. See Google's
|
|
|
116
116
|
|
|
117
117
|
## Breadcrumb structured data
|
|
118
118
|
|
|
119
|
-
`site.seo.breadcrumbs: true` emits a `BreadcrumbList` when at least
|
|
120
|
-
ancestor
|
|
119
|
+
`site.seo.breadcrumbs: true` emits a `BreadcrumbList` when the page has at least
|
|
120
|
+
one actual ancestor page in its locale (the home page counts); the trail ends
|
|
121
|
+
with the page itself. Intermediate folders without pages are skipped. To describe
|
|
121
122
|
a different navigation journey, supply at least two `{name, url}` items in a page's
|
|
122
123
|
`seo.breadcrumbs`. URLs must be absolute HTTP(S); the final URL must match that
|
|
123
124
|
page's canonical. Set `seo.breadcrumbs: false` on a page to disable it.
|
package/docs/quality-checks.md
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Quality checks
|
|
3
|
-
description: Validate a site,
|
|
3
|
+
description: Validate a documentation site, see which environments Cookbook supports, and review its output budgets.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
##
|
|
6
|
+
## Check your documentation site
|
|
7
7
|
|
|
8
|
-
Run `npm run validate` in a generated project: it checks the
|
|
9
|
-
local files, builds the site, and validates the
|
|
8
|
+
Run `npm run validate` in a generated project: it type-checks the project,
|
|
9
|
+
checks the configuration and local files, builds the site, and validates the
|
|
10
|
+
output. After deploying, run
|
|
10
11
|
`npx @tenphi/cookbook check-build --url https://docs.example.com/` against the
|
|
11
12
|
same build. See [CLI validation](./cli.md#check-the-built-site-and-deployment)
|
|
12
13
|
for coverage and preview-host behavior.
|
|
@@ -15,35 +16,16 @@ Also review keyboard navigation, mobile layouts, and all four light/dark and
|
|
|
15
16
|
normal/high-contrast combinations after changing styles. Automated accessibility
|
|
16
17
|
checks supplement this review; they do not establish complete accessibility.
|
|
17
18
|
|
|
18
|
-
##
|
|
19
|
+
## Supported environments
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
| `pnpm check:fonts` | Real Google variable/italic fonts, local fonts, and offline cache rebuild |
|
|
29
|
-
| `pnpm check:plugins` | Tested plugin contracts and actionable incompatibility failures |
|
|
30
|
-
| `pnpm check:recipes` | Public anatomy inventory and build-checked examples |
|
|
31
|
-
| `pnpm check:authoring` | Custom highlighting, code groups, mobile contents, hero images, and OpenAPI |
|
|
32
|
-
| `pnpm check:browser` | Chromium keyboard/focus, search, copy actions, appearance, mobile navigation, and axe checks |
|
|
33
|
-
| `pnpm check:install` | Clean installation and build from packed artifacts, including lint/type exports |
|
|
34
|
-
| `pnpm check:benchmark` | A generated 500-page corpus with 10,000 headings and code samples |
|
|
35
|
-
|
|
36
|
-
Install the browser once with `pnpm exec playwright install chromium`.
|
|
37
|
-
CI covers npm, pnpm, and Yarn installations, Node 22/24/26, and Linux, macOS,
|
|
38
|
-
and Windows in representative combinations. Yarn uses its `node-modules` linker;
|
|
39
|
-
Plug'n'Play is not covered. The weekly upstream canary installs the newest Astro
|
|
40
|
-
version allowed by Cookbook's peer range and actually builds the packed consumer.
|
|
41
|
-
Google Fonts checks run in that network-enabled canary. Published documentation
|
|
42
|
-
is checked after deployment against its uploaded build artifact.
|
|
43
|
-
|
|
44
|
-
The lint consumer uses TypeScript 6 for the typescript-eslint parser and the
|
|
45
|
-
workspace TypeScript compiler for public API checks; typescript-eslint currently
|
|
46
|
-
rejects the TypeScript 7 API. Runtime compilation and lint parsing are separate.
|
|
21
|
+
Cookbook's CI covers npm, pnpm, and Yarn installations, Node 22/24/26, and
|
|
22
|
+
Linux, macOS, and Windows in representative combinations. Yarn uses its
|
|
23
|
+
`node-modules` linker; Plug'n'Play is not covered. A weekly upstream canary
|
|
24
|
+
installs the newest Astro version allowed by Cookbook's peer range and builds
|
|
25
|
+
a packed consumer site. The same network-enabled canary runs the real Google
|
|
26
|
+
Fonts download check and a 1,000-page benchmark build. Cookbook's own
|
|
27
|
+
published documentation is checked after deployment against its uploaded build
|
|
28
|
+
artifact.
|
|
47
29
|
|
|
48
30
|
## Performance budgets and corpus measurements
|
|
49
31
|
|
|
@@ -55,8 +37,7 @@ router remain lazy. The initial JavaScript budget is 24 KiB.
|
|
|
55
37
|
The checked reference output contains about 73 KB of fonts, 66 KB of images and
|
|
56
38
|
icons, and a 181 KB shared stylesheet. The guide's first-party HTML, CSS, and
|
|
57
39
|
initial JavaScript total about 40 KB when gzipped. Actual network transfers vary
|
|
58
|
-
with hosting compression and caching.
|
|
59
|
-
prints current raw budgets and the gzip estimate; neither includes external
|
|
40
|
+
with hosting compression and caching. None of these figures include external
|
|
60
41
|
analytics.
|
|
61
42
|
|
|
62
43
|
A local macOS / Node 22.22 run processed 500 pages with 10,000 headings in about
|
|
@@ -66,11 +47,6 @@ observations on one machine, not throughput guarantees. The full-build corpus
|
|
|
66
47
|
uses explicit minimal navigation so the measurement is not dominated by repeating
|
|
67
48
|
hundreds of sidebar links in every page.
|
|
68
49
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
COOKBOOK_TEST_UPSTREAM=1 pnpm check:install
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
Investigate regressions before changing a budget. CI retains browser traces on
|
|
76
|
-
failure, and the benchmark reports graph timings, memory, and optional build time.
|
|
50
|
+
Cookbook's own test suite, browser checks, and benchmark commands are described
|
|
51
|
+
in the repository's
|
|
52
|
+
[contributing guide](https://github.com/tenphi/cookbook/blob/main/CONTRIBUTING.md#verification-suite).
|
package/docs/recipes.md
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
3
|
-
description: Complete, build-checked configurations for
|
|
2
|
+
title: Theme recipes
|
|
3
|
+
description: Complete, build-checked configurations for branding, component styles, fonts, and shared themes.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
These are complete `docs.config.ts` files
|
|
7
|
-
project, keep its `astro.config` integration, and
|
|
8
|
-
configuration with one recipe. Add the files listed
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
[theme guide](./theme-and-components.md) explains the customization path.
|
|
6
|
+
These are complete `docs.config.ts` files for common appearance changes. Start
|
|
7
|
+
with a generated Cookbook project, keep its `astro.config` integration, and
|
|
8
|
+
replace the documentation configuration with one recipe. Add the files listed
|
|
9
|
+
above each example. Every recipe is type-checked and built by Cookbook's test
|
|
10
|
+
suite.
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
[Working examples](./examples.md) cover repository, npm, language, and preview
|
|
13
|
+
layouts; the [theme guide](./theme-and-components.md) explains the
|
|
14
|
+
customization path, and the [configuration reference](./configuration.md) lists
|
|
15
|
+
every field.
|
|
17
16
|
|
|
18
|
-
## Brand, logo, and
|
|
17
|
+
## Brand, logo, and header control shape
|
|
19
18
|
|
|
20
19
|
Put your artwork at `public/logo.svg`. Logo files use their intrinsic aspect
|
|
21
20
|
ratio; the site title provides its label when the artwork is decorative.
|
|
@@ -30,15 +29,18 @@ export default defineDocsConfig({
|
|
|
30
29
|
},
|
|
31
30
|
theme: {
|
|
32
31
|
brand: { from: "#d97706" },
|
|
33
|
-
tokens: { "$header-control-radius": "
|
|
32
|
+
tokens: { "$header-control-radius": "8px", $radius: "6px" },
|
|
34
33
|
styles: { SearchResults: { Input: { radius: "12px" } } },
|
|
35
34
|
},
|
|
36
35
|
});
|
|
37
36
|
```
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
`$header-control-radius` replaces the default pill-shaped header buttons
|
|
39
|
+
(`999px`) and also covers the mobile sidebar close control. `$radius` changes
|
|
40
|
+
copy buttons, navigation items, and other content controls (default `8px`).
|
|
41
|
+
Built-in element overrides merge into the complete defaults. See the
|
|
42
|
+
[logo guide](./theme-and-components.md#logo-and-favicon) and the
|
|
43
|
+
[named style anatomy](./component-styles.md).
|
|
42
44
|
|
|
43
45
|
## Built-in component styles
|
|
44
46
|
|
|
@@ -94,49 +96,31 @@ Cookbook downloads and self-hosts the required weights and italics at build time
|
|
|
94
96
|
See [fonts](./fonts-and-typography.md#change-font-families) for caching,
|
|
95
97
|
explicit ranges, styles, and remote delivery.
|
|
96
98
|
|
|
97
|
-
##
|
|
99
|
+
## Share configuration and themes
|
|
98
100
|
|
|
99
|
-
|
|
100
|
-
`docs/fr/guide.md`. Routes are `/`, `/guide`, `/fr`, and `/fr/guide`.
|
|
101
|
+
A preset is an ordinary exported `DocsConfig` object:
|
|
101
102
|
|
|
102
|
-
```ts cookbook-verify=
|
|
103
|
-
import { defineDocsConfig } from "@tenphi/cookbook/config";
|
|
103
|
+
```ts cookbook-verify=shared-theme
|
|
104
|
+
import { defineDocsConfig, mergeDocsConfig } from "@tenphi/cookbook/config";
|
|
104
105
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
root: { label: "English", lang: "en" },
|
|
110
|
-
fr: { label: "Français" },
|
|
106
|
+
const company = defineDocsConfig({
|
|
107
|
+
theme: {
|
|
108
|
+
brand: { from: "#315efb" },
|
|
109
|
+
tokens: { $radius: "8px" },
|
|
111
110
|
},
|
|
112
|
-
|
|
113
|
-
navigation: ["/", "/guide"],
|
|
114
|
-
translations: { fr: { appearance: "Présentation" } },
|
|
111
|
+
markdown: { rawHtml: "sanitize" },
|
|
115
112
|
});
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
Navigation adapts to real translations. Missing translations use a real fallback
|
|
119
|
-
in the language picker; they do not generate phantom routes or alternate links.
|
|
120
|
-
|
|
121
|
-
## Preview publishing
|
|
122
113
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
```ts cookbook-verify=preview
|
|
127
|
-
import { defineDocsConfig } from "@tenphi/cookbook/config";
|
|
128
|
-
|
|
129
|
-
export default defineDocsConfig({
|
|
130
|
-
site: {
|
|
131
|
-
title: "Acme preview",
|
|
132
|
-
url: "https://preview.example.com",
|
|
133
|
-
seo: { index: false, copyPage: false },
|
|
134
|
-
},
|
|
135
|
-
tableOfContents: { mobile: true },
|
|
114
|
+
export default mergeDocsConfig(company, {
|
|
115
|
+
site: { title: "Product docs" },
|
|
116
|
+
theme: { tokens: { "$content-width": "52rem" } },
|
|
136
117
|
});
|
|
137
118
|
```
|
|
138
119
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
120
|
+
Each `theme.brand` or `theme.palette` color replaces the corresponding color in
|
|
121
|
+
the preset. Supply the complete Glaze declaration for a color you override.
|
|
122
|
+
|
|
123
|
+
Objects merge recursively, arrays replace, and inputs are not mutated. Tasty
|
|
124
|
+
styles preserve their default values when adding conditional overrides. A preset
|
|
125
|
+
can live in a shared workspace package. Component overrides remain partial Tasty
|
|
126
|
+
objects and merge into Cookbook's complete base styles inside the renderer.
|
|
@@ -63,8 +63,6 @@ Cookbook включает собственный рендерер Astro и ав
|
|
|
63
63
|
|
|
64
64
|
## Настройте сайт
|
|
65
65
|
|
|
66
|
-
Начните с готовых [рецептов для фирменного стиля, логотипа и шрифтов](../recipes.md). Более глубокие изменения стилей и создание компонентов описаны в [правилах настройки](../customization-rules.md). Эти правила и ссылки на первоисточники также входят в установленный пакет Cookbook.
|
|
67
|
-
|
|
68
66
|
Создайте `docs.config.ts` рядом с `astro.config.ts`:
|
|
69
67
|
|
|
70
68
|
```ts
|
|
@@ -83,9 +81,11 @@ export default defineDocsConfig({
|
|
|
83
81
|
});
|
|
84
82
|
```
|
|
85
83
|
|
|
86
|
-
В `theme.fonts` можно указать [Google Fonts по имени или собственные файлы шрифтов](../fonts-and-typography.md). Для типографики используйте `theme.presets`, для встроенных элементов — `theme.styles`, а для новых элементов — `defineComponent()` вместе с `theme.customStyles`. Начните с [руководства по теме](../theme-and-components.md); все настраиваемые части перечислены в [справочнике стилей компонентов](../component-styles.md).
|
|
84
|
+
В `theme.fonts` можно указать [Google Fonts по имени или собственные файлы шрифтов](../fonts-and-typography.md#change-font-families). Для типографики используйте `theme.presets`, для встроенных элементов — `theme.styles`, а для новых элементов — `defineComponent()` вместе с `theme.customStyles`. Начните с [руководства по теме](../theme-and-components.md); все настраиваемые части перечислены в [справочнике стилей компонентов](../component-styles.md).
|
|
85
|
+
|
|
86
|
+
Полные отправные точки собраны в [рецептах для фирменного стиля, логотипа и шрифтов](../recipes.md). Более глубокие изменения стилей и создание компонентов описаны в [правилах настройки](../customization-rules.md). Эти правила и ссылки на первоисточники также входят в установленный пакет Cookbook.
|
|
87
87
|
|
|
88
|
-
Интеграция и CLI загружают одну и ту же конфигурацию. Поддерживаются `docs.config.ts`, `.mts`, `.js` и `.mjs` именно в таком порядке. Явный объект `config` в интеграции имеет приоритет; `configFile: false` отключает обнаружение файла. Для нестандартного расположения используйте `cookbook({ configFile: "./config/manual.ts" })` и `cookbook doctor --config ./config/manual.ts`.
|
|
88
|
+
Интеграция и CLI загружают одну и ту же конфигурацию. Поддерживаются `docs.config.ts`, `.mts`, `.js` и `.mjs` именно в таком порядке. Явный объект `config` в интеграции имеет приоритет; `configFile: false` отключает обнаружение файла. Для нестандартного расположения используйте `cookbook({ configFile: "./config/manual.ts" })` и `cookbook doctor --config ./config/manual.ts`. Поскольку `root` указывается относительно каталога файла конфигурации, такому файлу нужен `root: ".."`, чтобы `README.md` и `docs/` по-прежнему читались из каталога приложения.
|
|
89
89
|
|
|
90
90
|
## Корневой каталог монорепозитория
|
|
91
91
|
|
|
@@ -106,4 +106,6 @@ npm run validate
|
|
|
106
106
|
npm run preview
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
`validate` проверяет типы проекта, запускает предварительную проверку Cookbook, собирает сайт и проверяет результат. Если проект настроен вручную, добавьте скрипты из [описания команд CLI](../cli.md) или запустите `npx @tenphi/cookbook doctor`.
|
|
110
|
+
|
|
111
|
+
Остальные руководства пока доступны на английском языке: [примеры](../examples.md), [компоненты для авторов](../authoring.mdx), [работа с ИИ-агентами](../ai-agents.md), [развёртывание](../deployment.md) и [обновление между версиями](../migration.md). Если проверка завершилась ошибкой, см. [решение проблем](../troubleshooting.md).
|
package/docs/ru/index.md
CHANGED
|
@@ -42,7 +42,7 @@ cd docs-site
|
|
|
42
42
|
npm run dev
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
Cookbook читает файлы на их текущем месте. Вы также можете [создать новый сайт](./getting-started.md), [описать именно те файлы, которые опубликованы в npm](./getting-started.md), или [добавить Cookbook в проект Astro](./getting-started.md).
|
|
45
|
+
Cookbook читает файлы на их текущем месте. Вы также можете [создать новый сайт](./getting-started.md#создайте-первый-сайт), [описать именно те файлы, которые опубликованы в npm](./getting-started.md#опишите-опубликованный-npm-пакет), или [добавить Cookbook в проект Astro](./getting-started.md#добавьте-cookbook-в-существующий-проект-astro).
|
|
46
46
|
|
|
47
47
|
## Этот сайт служит примером
|
|
48
48
|
|
package/docs/site-navigation.md
CHANGED
|
@@ -21,49 +21,6 @@ navigation: {
|
|
|
21
21
|
}
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
## Client navigation
|
|
25
|
-
|
|
26
|
-
Internal page links use client navigation over the generated static HTML. The
|
|
27
|
-
router loads when an internal page link is hovered, focused, or clicked, so it
|
|
28
|
-
does not add to the initial page download for readers who stay on one page. The
|
|
29
|
-
current page stays visible while the next page and its styles load, then swaps
|
|
30
|
-
without a full-page fade. Appearance preferences, sidebar expansion choices, and
|
|
31
|
-
desktop sidebar scroll within the same navigation section are preserved. Article
|
|
32
|
-
scroll resets to the top on page changes, including Back and Forward; links with
|
|
33
|
-
fragments still navigate to their heading. The current page and its ancestors
|
|
34
|
-
update from the destination markup. Mobile navigation and other open panels close.
|
|
35
|
-
|
|
36
|
-
Cookbook enables Astro's built-in hover prefetching by default. Hovering over or
|
|
37
|
-
focusing an internal link for about 80 ms downloads the destination HTML in the
|
|
38
|
-
background. Moving across links briefly does not prefetch them, and repeated
|
|
39
|
-
links to the same page share a prefetch. When the browser reports data-saving
|
|
40
|
-
mode or a slow connection, Astro waits for tap intent instead.
|
|
41
|
-
|
|
42
|
-
Prefetching warms the browser's HTTP cache. Static hosting should send cache
|
|
43
|
-
headers such as `Cache-Control` or `ETag` so navigation can reuse the response;
|
|
44
|
-
uncacheable responses may still be downloaded again on click. Browser and private
|
|
45
|
-
session policies can also limit cache reuse. Destination stylesheets remain part
|
|
46
|
-
of the router's preparation before the page swap.
|
|
47
|
-
|
|
48
|
-
Set `prefetch: false` in `astro.config.mjs` to disable page prefetching while
|
|
49
|
-
retaining client navigation. Cookbook preserves any explicit Astro `prefetch`
|
|
50
|
-
configuration, including `prefetchAll: false` for selective prefetching. For a
|
|
51
|
-
single link, use `data-astro-prefetch="false"` to opt out or
|
|
52
|
-
`data-astro-prefetch` to opt in. See [Astro's prefetch guide](https://docs.astro.build/en/guides/prefetch/)
|
|
53
|
-
for the supported strategies.
|
|
54
|
-
|
|
55
|
-
Search keeps its query and loaded engine between pages in the same language,
|
|
56
|
-
and closes when a result is followed. Language changes initialize the translated
|
|
57
|
-
search interface. External links, downloads, modified clicks, and links marked
|
|
58
|
-
`data-astro-reload` keep normal browser behavior. Without JavaScript, page links
|
|
59
|
-
use normal document navigation.
|
|
60
|
-
|
|
61
|
-
Custom browser scripts should attach behavior through custom-element lifecycle
|
|
62
|
-
callbacks or initialize on `astro:page-load`; bundled scripts are not rerun on
|
|
63
|
-
every client navigation. The router and appearance initialization belong to the
|
|
64
|
-
common page shell and remain available with replacement Header, Head, and
|
|
65
|
-
PageFrame components.
|
|
66
|
-
|
|
67
24
|
## Search
|
|
68
25
|
|
|
69
26
|
The production build creates a local Pagefind index. Readers can select Search
|
|
@@ -89,8 +46,8 @@ the tab's URL prefix when listed in that tab's `items`.
|
|
|
89
46
|
|
|
90
47
|
Top-level groups keep their headings and direct links visible. Deeper groups
|
|
91
48
|
open on click or keyboard activation, and the current page's ancestors open on
|
|
92
|
-
arrival.
|
|
93
|
-
is
|
|
49
|
+
arrival. Clicking a linked group header first selects its page and opens the
|
|
50
|
+
group; once that page is selected, clicking the header toggles the group. Explicit expansion choices are remembered for the browser
|
|
94
51
|
tab. Only the current page is highlighted.
|
|
95
52
|
|
|
96
53
|
On narrow screens, the active sidebar moves into a drawer. It includes the
|
|
@@ -113,7 +70,7 @@ navigation: [
|
|
|
113
70
|
"/deploying",
|
|
114
71
|
],
|
|
115
72
|
},
|
|
116
|
-
]
|
|
73
|
+
],
|
|
117
74
|
```
|
|
118
75
|
|
|
119
76
|
To keep the badge with its page, set it in frontmatter instead:
|
|
@@ -128,7 +85,7 @@ inherit the page's badge. An explicit navigation `badge` overrides frontmatter;
|
|
|
128
85
|
use `badge: ""` to hide an inherited badge. Badges are plain text, including
|
|
129
86
|
characters such as `<`, and do not change pagination labels.
|
|
130
87
|
|
|
131
|
-
Badges use the brand-derived `
|
|
88
|
+
Badges use the brand-derived `accent-text` and `accent-surface-subtle` palette roles
|
|
132
89
|
in every color scheme and contrast mode. Customize their appearance with a
|
|
133
90
|
partial [component style override](./component-styles.md):
|
|
134
91
|
|
|
@@ -164,3 +121,46 @@ exists and fall back to a real language or version home when it does not.
|
|
|
164
121
|
Only available translations appear in alternate-language metadata. See the
|
|
165
122
|
[language](./configuration.md#languages) and
|
|
166
123
|
[version](./configuration.md#site) configuration examples.
|
|
124
|
+
|
|
125
|
+
## Client navigation
|
|
126
|
+
|
|
127
|
+
Internal page links use client navigation over the generated static HTML. The
|
|
128
|
+
router loads when an internal page link is hovered, focused, or clicked, so it
|
|
129
|
+
does not add to the initial page download for readers who stay on one page. The
|
|
130
|
+
current page stays visible while the next page and its styles load, then swaps
|
|
131
|
+
without a full-page fade. Appearance preferences, sidebar expansion choices, and
|
|
132
|
+
desktop sidebar scroll within the same navigation section are preserved. Article
|
|
133
|
+
scroll resets to the top on page changes, including Back and Forward; links with
|
|
134
|
+
fragments still navigate to their heading. The current page and its ancestors
|
|
135
|
+
update from the destination markup. Mobile navigation and other open panels close.
|
|
136
|
+
|
|
137
|
+
Cookbook enables Astro's built-in hover prefetching by default. Hovering over or
|
|
138
|
+
focusing an internal link for about 80 ms downloads the destination HTML in the
|
|
139
|
+
background. Moving across links briefly does not prefetch them, and repeated
|
|
140
|
+
links to the same page share a prefetch. When the browser reports data-saving
|
|
141
|
+
mode or a slow connection, Astro waits for tap intent instead.
|
|
142
|
+
|
|
143
|
+
Prefetching warms the browser's HTTP cache. Static hosting should send cache
|
|
144
|
+
headers such as `Cache-Control` or `ETag` so navigation can reuse the response;
|
|
145
|
+
uncacheable responses may still be downloaded again on click. Browser and private
|
|
146
|
+
session policies can also limit cache reuse. Destination stylesheets remain part
|
|
147
|
+
of the router's preparation before the page swap.
|
|
148
|
+
|
|
149
|
+
Set `prefetch: false` in `astro.config.ts` to disable page prefetching while
|
|
150
|
+
retaining client navigation. Cookbook preserves any explicit Astro `prefetch`
|
|
151
|
+
configuration, including `prefetchAll: false` for selective prefetching. For a
|
|
152
|
+
single link, use `data-astro-prefetch="false"` to opt out or
|
|
153
|
+
`data-astro-prefetch` to opt in. See [Astro's prefetch guide](https://docs.astro.build/en/guides/prefetch/)
|
|
154
|
+
for the supported strategies.
|
|
155
|
+
|
|
156
|
+
Search keeps its query and loaded engine between pages in the same language,
|
|
157
|
+
and closes when a result is followed. Language changes initialize the translated
|
|
158
|
+
search interface. External links, downloads, modified clicks, and links marked
|
|
159
|
+
`data-astro-reload` keep normal browser behavior. Without JavaScript, page links
|
|
160
|
+
use normal document navigation.
|
|
161
|
+
|
|
162
|
+
Custom browser scripts should attach behavior through custom-element lifecycle
|
|
163
|
+
callbacks or initialize on `astro:page-load`; bundled scripts are not rerun on
|
|
164
|
+
every client navigation. The router and appearance initialization belong to the
|
|
165
|
+
common page shell and remain available with replacement Header, Head, and
|
|
166
|
+
PageFrame components.
|