@writedocs/generator 0.13.3 → 0.13.5

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 (87) hide show
  1. package/README.md +28 -28
  2. package/astro.config.mjs +645 -645
  3. package/bin/writedocs.js +43 -12
  4. package/package.json +99 -99
  5. package/src/cli/base-path-layout.js +44 -44
  6. package/src/cli/build-auth.js +135 -135
  7. package/src/cli/build.js +203 -203
  8. package/src/cli/check-built-styles.js +41 -41
  9. package/src/cli/convert.js +1 -1
  10. package/src/cli/dev.js +268 -268
  11. package/src/cli/exit-when-flushed.js +4 -0
  12. package/src/cli/generate-api-pages.js +507 -507
  13. package/src/cli/og-image-worker.js +20 -20
  14. package/src/cli/og-images.js +70 -70
  15. package/src/cli/page-list-watch.js +69 -69
  16. package/src/cli/run-astro.js +97 -97
  17. package/src/cli/run-pagefind.js +154 -154
  18. package/src/cli/write-mcp-files.js +103 -103
  19. package/src/cli/write-redirects-file.js +158 -158
  20. package/src/components/ApiReferencePanel.astro +1792 -1792
  21. package/src/components/AppIcon.astro +51 -51
  22. package/src/components/Card.astro +193 -193
  23. package/src/components/CodeGroup.astro +63 -39
  24. package/src/components/CopyPageMenu.astro +374 -374
  25. package/src/components/Hint.astro +188 -188
  26. package/src/components/Icon.astro +72 -72
  27. package/src/components/Image.astro +165 -165
  28. package/src/components/Tile.astro +67 -67
  29. package/src/components/Video.astro +137 -137
  30. package/src/content.config.ts +203 -203
  31. package/src/layout/BaseLayout.astro +908 -908
  32. package/src/layout/components/AnalyticsScripts.astro +49 -49
  33. package/src/layout/components/Breadcrumbs.astro +98 -98
  34. package/src/layout/components/ConsentBanner.astro +119 -119
  35. package/src/layout/components/MobileMenu.astro +225 -225
  36. package/src/layout/components/NavTree.astro +408 -408
  37. package/src/layout/components/Sidebar.astro +232 -232
  38. package/src/layout/components/SiteFooter.astro +87 -87
  39. package/src/layout/components/TopBar.astro +386 -386
  40. package/src/layout/styles/base.css +332 -326
  41. package/src/layout/styles/mobile-menu.css +285 -285
  42. package/src/lib/agent-markdown.js +164 -164
  43. package/src/lib/asset-dimensions.js +89 -89
  44. package/src/lib/base-path.js +90 -90
  45. package/src/lib/cli-report.js +22 -22
  46. package/src/lib/code-line-numbers.js +13 -0
  47. package/src/lib/config-schema.js +414 -75
  48. package/src/lib/config-schema.ts +2509 -1905
  49. package/src/lib/config.ts +1316 -1314
  50. package/src/lib/consent.js +108 -108
  51. package/src/lib/content-store-reload-integration.js +101 -101
  52. package/src/lib/icon-data-dev.js +53 -53
  53. package/src/lib/image-size.js +152 -152
  54. package/src/lib/json-schema-descriptions.js +228 -228
  55. package/src/lib/link-check.js +544 -544
  56. package/src/lib/llms-index.ts +90 -90
  57. package/src/lib/mcp-dev-integration.js +65 -65
  58. package/src/lib/mcp-index.ts +102 -102
  59. package/src/lib/mintlify-convert.js +605 -605
  60. package/src/lib/moved-api-pages.js +49 -49
  61. package/src/lib/og-cards.js +33 -33
  62. package/src/lib/og-image.js +235 -235
  63. package/src/lib/openapi-dev-status.js +80 -80
  64. package/src/lib/openapi-reload-integration.js +193 -193
  65. package/src/lib/pages.js +312 -312
  66. package/src/lib/project-files-integration.js +116 -116
  67. package/src/lib/project-files.js +137 -137
  68. package/src/lib/rehype-base-path.js +62 -62
  69. package/src/lib/rehype-image-loading.js +71 -71
  70. package/src/lib/robots-txt.js +21 -21
  71. package/src/lib/search-scope.js +44 -44
  72. package/src/lib/selector-placement.js +50 -50
  73. package/src/lib/seo-tags.js +155 -155
  74. package/src/lib/shiki-code-block.js +7 -1
  75. package/src/lib/site-base.ts +27 -27
  76. package/src/lib/styles-asset-integration.js +291 -291
  77. package/src/lib/wdignore-cases.json +195 -195
  78. package/src/lib/wdignore.js +177 -177
  79. package/src/pages/404.astro +63 -63
  80. package/src/pages/[...slug].astro +1762 -1608
  81. package/src/pages/[...slug].md.ts +93 -93
  82. package/src/pages/llms-full.txt.ts +88 -88
  83. package/src/pages/og/[...slug].png.ts +63 -63
  84. package/src/scripts/mobile-menu.ts +80 -80
  85. package/src/scripts/search.ts +245 -245
  86. package/src/scripts/sidebar-scroll.ts +61 -61
  87. package/src/styles/global.css +40 -40
@@ -1,228 +1,228 @@
1
- // The editor help text for writedocs.schema.json (see lib/json-schema.js):
2
- // one entry per field of writedocs.json, keyed by its path - `a.b.c`, with
3
- // `[]` for an array's items. Fields inside the navigation's recursive types
4
- // are keyed by the type's name instead (`Tab.icon`, `NavigationItem.group`).
5
- //
6
- // scripts/json-schema.test.js fails when a field has no entry here, or an
7
- // entry names a field that doesn't exist - so a new field in
8
- // config-schema.ts needs its description added here too.
9
-
10
- const CHILDREN = {
11
- pages: 'The pages and groups in this section of the sidebar.',
12
- tabs: 'Tabs inside this one.',
13
- versions: 'Versions inside this one - a version picker in the sidebar.',
14
- languages: 'Languages inside this one - a language picker.',
15
- dropdowns: 'Dropdowns inside this one. Inside a tab they are its menu, and inside one of those a flyout beside its entry - two levels at most; elsewhere, a switcher.',
16
- products: 'Products inside this one - a product picker.',
17
- href: 'Makes this a link to another address instead of a section with pages of its own.',
18
- };
19
-
20
- const CONTAINERS = {
21
- Tab: {
22
- tab: 'The tab\'s name, shown in the topbar.',
23
- icon: 'Icon next to the name: a Lucide name ("book-open"), "collection:name" ("mdi:server"), an emoji, or an image path.',
24
- },
25
- Version: {
26
- version: 'The version\'s name, like "v2".',
27
- label: 'Text shown in the version picker instead of `version`.',
28
- tag: 'A short badge next to the version, like "Latest" or "Deprecated".',
29
- default: 'Open this version first. Without it, the first version is the default.',
30
- },
31
- Language: {
32
- language: 'The language code, like "en" or "pt-BR".',
33
- label: 'Text shown in the language picker instead of `language`, like "Português".',
34
- },
35
- Dropdown: {
36
- dropdown: 'The dropdown\'s name.',
37
- icon: 'Icon next to the name: a Lucide name, "collection:name", an emoji, or an image path.',
38
- },
39
- Product: {
40
- product: 'The product\'s name, shown in the product picker.',
41
- icon: 'Icon next to the name: a Lucide name, "collection:name", an emoji, or an image path.',
42
- description: 'One line under the name in the product picker.',
43
- },
44
- };
45
-
46
- const HIDDEN = {
47
- hidden: 'Reachable only by its address: no tab, switcher or menu lists it, and inside it this level isn\'t shown. Its pages search only among themselves.',
48
- searchPublic: 'For a hidden item: its search also finds the site\'s public pages.',
49
- page: 'A page of its own - an overview - that choosing this item opens, in place of its first page. Shown inside the item; in a sidebar too, it opens there.',
50
- };
51
-
52
- const containerEntries = Object.entries(CONTAINERS).flatMap(([type, fields]) => [
53
- ...Object.entries(fields).map(([field, text]) => [`${type}.${field}`, text]),
54
- ...Object.entries(CHILDREN).map(([field, text]) => [`${type}.${field}`, text]),
55
- ...Object.entries(HIDDEN).map(([field, text]) => [`${type}.${field}`, text]),
56
- ]);
57
-
58
- const logo = (where) => ({
59
- [where]: 'The logo: one image path for both color modes, or `{ light, dark, label }` with an image per mode.',
60
- [`${where}.light`]: 'Logo image shown in light mode.',
61
- [`${where}.dark`]: 'Logo image shown in dark mode.',
62
- [`${where}.label`]: 'Text shown next to the logo. No text is shown by default - a logo is usually already a wordmark.',
63
- });
64
-
65
- const font = (where, what) => ({
66
- [`${where}.family`]: `Font family for ${what}. A Google Fonts name loads automatically; add \`source\` for a font file instead.`,
67
- [`${where}.weight`]: `Font weight for ${what}, like 400 or 700.`,
68
- [`${where}.source`]: 'Path or URL of a font file to load, instead of Google Fonts.',
69
- [`${where}.format`]: 'Format of the `source` font file.',
70
- });
71
-
72
- const link = (where) => ({
73
- [`${where}.label`]: 'Link text. A link needs a label, an icon, or both.',
74
- [`${where}.href`]: 'Where the link goes - a site path like "/docs/intro/" or a full URL.',
75
- [`${where}.icon`]: 'Icon shown with the link: a Lucide name, "collection:name", an emoji, or an image path.',
76
- });
77
-
78
- const script = (where) => ({
79
- [`${where}.src`]: 'URL of the script to load. Use either `src` or `content`, not both.',
80
- [`${where}.content`]: 'The script\'s code, inline. Use either `src` or `content`, not both.',
81
- [`${where}.consent`]: 'With `integrations.consent` on, load this script only once the reader accepts.',
82
- });
83
-
84
- export const ROOT_DESCRIPTION = 'Configuration of a writedocs site: its name, look, navigation and integrations.';
85
-
86
- export const TYPE_DESCRIPTIONS = {
87
- NavigationItem: 'A page (its path from the project folder, without the extension), a group of pages, or a link.',
88
- Tab: 'A tab in the topbar, with its own sidebar.',
89
- Version: 'A version of the docs, chosen from a version picker.',
90
- Language: 'A language of the docs, chosen from a language picker.',
91
- Dropdown: 'A section chosen from a dropdown menu.',
92
- Product: 'A product, chosen from a product picker.',
93
- };
94
-
95
- export const DESCRIPTIONS = {
96
- $schema: 'The JSON Schema this file follows - for editor autocompletion and checks.',
97
- name: 'Required. The site\'s name - shown in the browser tab ("Page title · name") and as the topbar text when there\'s no logo.',
98
- description: 'Description used for pages that don\'t set their own `description` in frontmatter.',
99
-
100
- styles: 'Colors, logo, favicon, fonts, code block themes, navbar and background.',
101
- 'styles.colors': 'The site\'s colors.',
102
- 'styles.colors.primary': 'Main color: links, buttons, the active page in the sidebar. Default "#6366f1".',
103
- 'styles.colors.text': 'Body text color in light mode, and the sidebar pages. Default "#404045".',
104
- 'styles.colors.dark': 'Dark-mode colors. Anything left out uses the light-mode value.',
105
- 'styles.colors.dark.primary': 'Main color in dark mode. Pick a lighter one if `primary` is dark - links use it on a dark background.',
106
- 'styles.colors.dark.text': 'Body text color in dark mode, and the sidebar pages. Default "#a0a0a5".',
107
- ...logo('styles.logo'),
108
- 'styles.favicon': 'Favicon image path.',
109
- 'styles.fonts': 'Fonts. Default: Inter. `heading` and `body` override just that part; anything they leave out comes from the top-level fields.',
110
- ...font('styles.fonts', 'all text'),
111
- 'styles.fonts.heading': 'Font for headings only.',
112
- ...font('styles.fonts.heading', 'headings'),
113
- 'styles.fonts.body': 'Font for body text only.',
114
- ...font('styles.fonts.body', 'body text'),
115
- 'styles.codeblocks': 'Syntax-highlighting themes for code blocks and the API playground.',
116
- 'styles.codeblocks.light': 'Shiki theme name for light mode (https://shiki.style/themes). Default "github-light".',
117
- 'styles.codeblocks.dark': 'Shiki theme name for dark mode. Default "github-dark".',
118
- 'styles.codeblocks.langAlias': 'Extra language names for code blocks, mapped to a language Shiki knows - like { "curl": "bash" }.',
119
- 'styles.navbar': 'The topbar\'s own background. Without it, the topbar matches the page background. Its text turns black or white automatically.',
120
- 'styles.navbar.light': 'Topbar in light mode: a background color, or `{ background, accent }`.',
121
- 'styles.navbar.light.background': 'Topbar background color in light mode.',
122
- 'styles.navbar.light.accent': 'Color of the underline under the active tab in the topbar, in place of `styles.colors.primary`.',
123
- 'styles.navbar.dark': 'Topbar in dark mode: a background color, or `{ background, accent }`.',
124
- 'styles.navbar.dark.background': 'Topbar background color in dark mode.',
125
- 'styles.navbar.dark.accent': 'Color of the underline under the active tab in the topbar, in dark mode.',
126
- 'styles.background': 'Background color of the site, and an optional background image.',
127
- 'styles.background.colors': 'Background colors.',
128
- 'styles.background.colors.light': 'Background color in light mode. Default "#ffffff".',
129
- 'styles.background.colors.dark': 'Background color in dark mode. Default "#0b1120".',
130
- 'styles.background.images': 'Background images, shown behind the content and sidebar.',
131
- 'styles.background.images.light': 'Background image in light mode.',
132
- 'styles.background.images.dark': 'Background image in dark mode.',
133
-
134
- navigation:
135
- 'Required. The site\'s structure: a list of pages and groups, or an object with exactly one of `tabs`, `versions`, `languages`, `dropdowns` or `products`. Those can nest inside each other.',
136
- 'navigation.global': 'Dropdowns shown on every page, whatever section is open.',
137
- 'navigation.global.dropdowns': 'Dropdowns shown on every page.',
138
- 'navigation.tabs': 'Tabs in the topbar, each with its own sidebar.',
139
- 'navigation.versions': 'Versions of the docs, with a version picker.',
140
- 'navigation.languages': 'Languages of the docs, with a language picker.',
141
- 'navigation.dropdowns': 'Sections chosen from a dropdown menu.',
142
- 'navigation.products': 'Products, with a product picker.',
143
-
144
- 'NavigationItem.group': 'The group\'s name in the sidebar.',
145
- 'NavigationItem.page': 'A page the group\'s name links to.',
146
- 'NavigationItem.pages': 'The pages and groups inside this group.',
147
- 'NavigationItem.openapi': 'Generate this group\'s pages from an OpenAPI spec - a page per operation, grouped by tag.',
148
- 'NavigationItem.openapi.src': 'Path of the OpenAPI spec file, relative to writedocs.json.',
149
- 'NavigationItem.openapi.path': 'URL path the generated pages go under, like "/api". Each OpenAPI group needs its own.',
150
- 'NavigationItem.label': 'Link text in the sidebar.',
151
- 'NavigationItem.href': 'Where the link goes.',
152
- ...Object.fromEntries(containerEntries),
153
-
154
- socials: 'Icon links in the footer: platform -> URL, like { "github": "https://github.com/acme" }. The key is also the icon.',
155
- topbar: 'The topbar.',
156
- 'topbar.links': 'Links at the right of the topbar.',
157
- ...link('topbar.links[]'),
158
- footer: 'The footer: columns of links, and the `socials` icons.',
159
- 'footer.columns': 'Columns of links.',
160
- 'footer.columns[].title': 'The column\'s heading. Optional.',
161
- 'footer.columns[].links': 'The links in the column.',
162
- ...link('footer.columns[].links[]'),
163
- ...logo('footer.logo'),
164
-
165
- api: 'The API playground.',
166
- 'api.proxy': 'When the browser blocks a "Try it" request (the API doesn\'t allow calls from other sites - CORS), retry it through writedocs\' proxy. Requests always go to the API directly first. Default true.',
167
- domain: 'The site\'s address, like "docs.example.com". Turns on sitemap.xml and absolute URLs in link previews.',
168
- basePath: 'The path the site is served under, like "/docs" for example.com/docs - usually behind your own proxy. Every address the site makes starts with it, and the build writes the site to dist/docs/. Starts with "/", no "/" at the end; lowercase letters, digits, "-" and "_". Default: none, the site at the root.',
169
-
170
- seo: 'Default metadata for every page. A page\'s own `seo` frontmatter overrides it field by field.',
171
- 'seo.ogImage': 'Image shown in link previews - a path or a full URL.',
172
- 'seo.generatedOgImage': 'Whether a page without an `ogImage` gets a link preview image generated at build time. Default true; set false to skip them, which shortens the build of a large site.',
173
- 'seo.ogType': 'The og:type of pages. Default "website".',
174
- 'seo.twitterCard': 'X/Twitter card style. Default "summary_large_image" with an `ogImage`, "summary" without.',
175
- 'seo.keywords': 'Keywords for the <meta name="keywords"> tag.',
176
- 'seo.noindex': 'Ask search engines not to index pages, and leave them out of sitemap.xml.',
177
- 'seo.robots': 'The whole <meta name="robots"> value, like "noindex, follow". Replaces `noindex`; a value with "noindex" leaves pages out of sitemap.xml too.',
178
- 'seo.organization': 'Who publishes the site, for search engines: an Organization in the home page\'s structured data, and the publisher of every page.',
179
- 'seo.organization.name': 'The organization\'s name, like "Acme".',
180
- 'seo.organization.url': 'The organization\'s own site. Default: this site\'s address.',
181
- 'seo.organization.logo': 'Its logo - a path or a full URL. Default: the site\'s logo.',
182
- 'seo.organization.sameAs': 'Its profiles on other sites. Default: the URLs in `socials`.',
183
- 'seo.metatags':'Other <meta> tags, name to content - like { "google-site-verification": "..." }. One with the name of a tag writedocs writes ("og:image", "twitter:image") replaces it.',
184
- contextMenu: 'The "Copy page" menu on every page - copy as Markdown, view as Markdown, open in ChatGPT, Claude or Perplexity, copy the MCP server URL, connect to Cursor or VS Code - and a Markdown copy of each page at its address + ".md". On by default with every option (the MCP ones only while `mcp` is on). A list picks the options ("copy", "view", "chatgpt", "claude", "perplexity", "mcp", "cursor", "vscode"); false turns it all off.',
185
- 'contextMenu.openIn': 'The earlier form: which AI assistants the menu offers, besides copy and view. A list of options replaces it.',
186
- mcp: 'An MCP server at /mcp, so AI tools can search and read the docs. The build adds its index and a Cloudflare-ready _worker.js to dist/. Default true; false leaves them out.',
187
- redirects: 'Redirects from old addresses. Each matches one exact path.',
188
- 'redirects[].source': 'The old path, like "/old-page".',
189
- 'redirects[].destination': 'Where to send it, like "/docs/new-page/".',
190
- variables: 'Values pages can insert with [[name]], like { "productName": "Acme" }.',
191
- banner: 'A banner above the topbar on every page.',
192
- 'banner.content': 'The banner\'s text. Markdown links work.',
193
- 'banner.dismissible': 'Let readers close it. Default false.',
194
- 'banner.type': 'Its color: "info", "warning" or "critical". Default "info".',
195
- notFound: 'The 404 page.',
196
- 'notFound.title': 'The 404 page\'s title.',
197
- 'notFound.description': 'Text under the title on the 404 page.',
198
- scripts: 'Scripts added to every page - for tools `integrations` doesn\'t cover.',
199
- 'scripts.head': 'Scripts added at the end of <head>.',
200
- ...script('scripts.head[]'),
201
- 'scripts.body': 'Scripts added at the end of <body>.',
202
- ...script('scripts.body[]'),
203
-
204
- integrations: 'Analytics and chat tools.',
205
- 'integrations.ga4': 'Google Analytics 4.',
206
- 'integrations.ga4.measurementId': 'Measurement ID, like "G-XXXXXXXXXX".',
207
- 'integrations.googleTagManager': 'Google Tag Manager.',
208
- 'integrations.googleTagManager.containerId': 'Container ID, like "GTM-XXXXXXX".',
209
- 'integrations.plausible': 'Plausible Analytics.',
210
- 'integrations.plausible.domain': 'The site\'s domain, as registered in Plausible.',
211
- 'integrations.plausible.src': 'Script URL, for a self-hosted Plausible. Default "https://plausible.io/js/script.js".',
212
- 'integrations.fathom': 'Fathom Analytics.',
213
- 'integrations.fathom.siteId': 'Fathom\'s site ID, like "ABCDEFGH".',
214
- 'integrations.posthog': 'PostHog.',
215
- 'integrations.posthog.apiKey': 'Project API key, starting with "phc_".',
216
- 'integrations.posthog.apiHost': 'API host. Default "https://us.i.posthog.com" - use yours for EU cloud or self-hosting.',
217
- 'integrations.umami': 'Umami Analytics.',
218
- 'integrations.umami.websiteId': 'Umami\'s website ID.',
219
- 'integrations.umami.src': 'Script URL. Default "https://cloud.umami.is/script.js" - use yours when self-hosting.',
220
- 'integrations.askAi': 'AI chat over the docs, with DocsBot.',
221
- 'integrations.askAi.id': 'DocsBot\'s "teamId/botId". The WRITEDOCS_ASK_AI_ID environment variable overrides it.',
222
- 'integrations.consent': 'A consent banner: the analytics integrations load only once the reader accepts. true uses the default texts; an object changes them.',
223
- 'integrations.consent.message': 'The banner\'s text.',
224
- 'integrations.consent.acceptLabel': 'The accept button\'s text. Default "Accept".',
225
- 'integrations.consent.declineLabel': 'The decline button\'s text. Default "Decline".',
226
- 'integrations.consent.policyUrl': 'A link after the text, to your privacy or cookie policy.',
227
- 'integrations.consent.policyLabel': 'That link\'s text. Default "Privacy policy".',
228
- };
1
+ // The editor help text for writedocs.schema.json (see lib/json-schema.js):
2
+ // one entry per field of writedocs.json, keyed by its path - `a.b.c`, with
3
+ // `[]` for an array's items. Fields inside the navigation's recursive types
4
+ // are keyed by the type's name instead (`Tab.icon`, `NavigationItem.group`).
5
+ //
6
+ // scripts/json-schema.test.js fails when a field has no entry here, or an
7
+ // entry names a field that doesn't exist - so a new field in
8
+ // config-schema.ts needs its description added here too.
9
+
10
+ const CHILDREN = {
11
+ pages: 'The pages and groups in this section of the sidebar.',
12
+ tabs: 'Tabs inside this one.',
13
+ versions: 'Versions inside this one - a version picker in the sidebar.',
14
+ languages: 'Languages inside this one - a language picker.',
15
+ dropdowns: 'Dropdowns inside this one. Inside a tab they are its menu, and inside one of those a flyout beside its entry - two levels at most; elsewhere, a switcher.',
16
+ products: 'Products inside this one - a product picker.',
17
+ href: 'Makes this a link to another address instead of a section with pages of its own.',
18
+ };
19
+
20
+ const CONTAINERS = {
21
+ Tab: {
22
+ tab: 'The tab\'s name, shown in the topbar.',
23
+ icon: 'Icon next to the name: a Lucide name ("book-open"), "collection:name" ("mdi:server"), an emoji, or an image path.',
24
+ },
25
+ Version: {
26
+ version: 'The version\'s name, like "v2".',
27
+ label: 'Text shown in the version picker instead of `version`.',
28
+ tag: 'A short badge next to the version, like "Latest" or "Deprecated".',
29
+ default: 'Open this version first. Without it, the first version is the default.',
30
+ },
31
+ Language: {
32
+ language: 'The language code, like "en" or "pt-BR".',
33
+ label: 'Text shown in the language picker instead of `language`, like "Português".',
34
+ },
35
+ Dropdown: {
36
+ dropdown: 'The dropdown\'s name.',
37
+ icon: 'Icon next to the name: a Lucide name, "collection:name", an emoji, or an image path.',
38
+ },
39
+ Product: {
40
+ product: 'The product\'s name, shown in the product picker.',
41
+ icon: 'Icon next to the name: a Lucide name, "collection:name", an emoji, or an image path.',
42
+ description: 'One line under the name in the product picker.',
43
+ },
44
+ };
45
+
46
+ const HIDDEN = {
47
+ hidden: 'Reachable only by its address: no tab, switcher or menu lists it, and inside it this level isn\'t shown. Its pages search only among themselves.',
48
+ searchPublic: 'For a hidden item: its search also finds the site\'s public pages.',
49
+ page: 'A page of its own - an overview - that choosing this item opens, in place of its first page. Shown inside the item; in a sidebar too, it opens there.',
50
+ };
51
+
52
+ const containerEntries = Object.entries(CONTAINERS).flatMap(([type, fields]) => [
53
+ ...Object.entries(fields).map(([field, text]) => [`${type}.${field}`, text]),
54
+ ...Object.entries(CHILDREN).map(([field, text]) => [`${type}.${field}`, text]),
55
+ ...Object.entries(HIDDEN).map(([field, text]) => [`${type}.${field}`, text]),
56
+ ]);
57
+
58
+ const logo = (where) => ({
59
+ [where]: 'The logo: one image path for both color modes, or `{ light, dark, label }` with an image per mode.',
60
+ [`${where}.light`]: 'Logo image shown in light mode.',
61
+ [`${where}.dark`]: 'Logo image shown in dark mode.',
62
+ [`${where}.label`]: 'Text shown next to the logo. No text is shown by default - a logo is usually already a wordmark.',
63
+ });
64
+
65
+ const font = (where, what) => ({
66
+ [`${where}.family`]: `Font family for ${what}. A Google Fonts name loads automatically; add \`source\` for a font file instead.`,
67
+ [`${where}.weight`]: `Font weight for ${what}, like 400 or 700.`,
68
+ [`${where}.source`]: 'Path or URL of a font file to load, instead of Google Fonts.',
69
+ [`${where}.format`]: 'Format of the `source` font file.',
70
+ });
71
+
72
+ const link = (where) => ({
73
+ [`${where}.label`]: 'Link text. A link needs a label, an icon, or both.',
74
+ [`${where}.href`]: 'Where the link goes - a site path like "/docs/intro/" or a full URL.',
75
+ [`${where}.icon`]: 'Icon shown with the link: a Lucide name, "collection:name", an emoji, or an image path.',
76
+ });
77
+
78
+ const script = (where) => ({
79
+ [`${where}.src`]: 'URL of the script to load. Use either `src` or `content`, not both.',
80
+ [`${where}.content`]: 'The script\'s code, inline. Use either `src` or `content`, not both.',
81
+ [`${where}.consent`]: 'With `integrations.consent` on, load this script only once the reader accepts.',
82
+ });
83
+
84
+ export const ROOT_DESCRIPTION = 'Configuration of a writedocs site: its name, look, navigation and integrations.';
85
+
86
+ export const TYPE_DESCRIPTIONS = {
87
+ NavigationItem: 'A page (its path from the project folder, without the extension), a group of pages, or a link.',
88
+ Tab: 'A tab in the topbar, with its own sidebar.',
89
+ Version: 'A version of the docs, chosen from a version picker.',
90
+ Language: 'A language of the docs, chosen from a language picker.',
91
+ Dropdown: 'A section chosen from a dropdown menu.',
92
+ Product: 'A product, chosen from a product picker.',
93
+ };
94
+
95
+ export const DESCRIPTIONS = {
96
+ $schema: 'The JSON Schema this file follows - for editor autocompletion and checks.',
97
+ name: 'Required. The site\'s name - shown in the browser tab ("Page title · name") and as the topbar text when there\'s no logo.',
98
+ description: 'Description used for pages that don\'t set their own `description` in frontmatter.',
99
+
100
+ styles: 'Colors, logo, favicon, fonts, code block themes, navbar and background.',
101
+ 'styles.colors': 'The site\'s colors.',
102
+ 'styles.colors.primary': 'Main color: links, buttons, the active page in the sidebar. Default "#6366f1".',
103
+ 'styles.colors.text': 'Body text color in light mode, and the sidebar pages. Default "#404045".',
104
+ 'styles.colors.dark': 'Dark-mode colors. Anything left out uses the light-mode value.',
105
+ 'styles.colors.dark.primary': 'Main color in dark mode. Pick a lighter one if `primary` is dark - links use it on a dark background.',
106
+ 'styles.colors.dark.text': 'Body text color in dark mode, and the sidebar pages. Default "#a0a0a5".',
107
+ ...logo('styles.logo'),
108
+ 'styles.favicon': 'Favicon image path.',
109
+ 'styles.fonts': 'Fonts. Default: Inter. `heading` and `body` override just that part; anything they leave out comes from the top-level fields.',
110
+ ...font('styles.fonts', 'all text'),
111
+ 'styles.fonts.heading': 'Font for headings only.',
112
+ ...font('styles.fonts.heading', 'headings'),
113
+ 'styles.fonts.body': 'Font for body text only.',
114
+ ...font('styles.fonts.body', 'body text'),
115
+ 'styles.codeblocks': 'Syntax-highlighting themes for code blocks and the API playground.',
116
+ 'styles.codeblocks.light': 'Shiki theme name for light mode (https://shiki.style/themes). Default "github-light".',
117
+ 'styles.codeblocks.dark': 'Shiki theme name for dark mode. Default "github-dark".',
118
+ 'styles.codeblocks.langAlias': 'Extra language names for code blocks, mapped to a language Shiki knows - like { "curl": "bash" }.',
119
+ 'styles.navbar': 'The topbar\'s own background. Without it, the topbar matches the page background. Its text turns black or white automatically.',
120
+ 'styles.navbar.light': 'Topbar in light mode: a background color, or `{ background, accent }`.',
121
+ 'styles.navbar.light.background': 'Topbar background color in light mode.',
122
+ 'styles.navbar.light.accent': 'Color of the underline under the active tab in the topbar, in place of `styles.colors.primary`.',
123
+ 'styles.navbar.dark': 'Topbar in dark mode: a background color, or `{ background, accent }`.',
124
+ 'styles.navbar.dark.background': 'Topbar background color in dark mode.',
125
+ 'styles.navbar.dark.accent': 'Color of the underline under the active tab in the topbar, in dark mode.',
126
+ 'styles.background': 'Background color of the site, and an optional background image.',
127
+ 'styles.background.colors': 'Background colors.',
128
+ 'styles.background.colors.light': 'Background color in light mode. Default "#ffffff".',
129
+ 'styles.background.colors.dark': 'Background color in dark mode. Default "#0b1120".',
130
+ 'styles.background.images': 'Background images, shown behind the content and sidebar.',
131
+ 'styles.background.images.light': 'Background image in light mode.',
132
+ 'styles.background.images.dark': 'Background image in dark mode.',
133
+
134
+ navigation:
135
+ 'Required. The site\'s structure: a list of pages and groups, or an object with exactly one of `tabs`, `versions`, `languages`, `dropdowns` or `products`. Those can nest inside each other.',
136
+ 'navigation.global': 'Dropdowns shown on every page, whatever section is open.',
137
+ 'navigation.global.dropdowns': 'Dropdowns shown on every page.',
138
+ 'navigation.tabs': 'Tabs in the topbar, each with its own sidebar.',
139
+ 'navigation.versions': 'Versions of the docs, with a version picker.',
140
+ 'navigation.languages': 'Languages of the docs, with a language picker.',
141
+ 'navigation.dropdowns': 'Sections chosen from a dropdown menu.',
142
+ 'navigation.products': 'Products, with a product picker.',
143
+
144
+ 'NavigationItem.group': 'The group\'s name in the sidebar.',
145
+ 'NavigationItem.page': 'A page the group\'s name links to.',
146
+ 'NavigationItem.pages': 'The pages and groups inside this group.',
147
+ 'NavigationItem.openapi': 'Generate this group\'s pages from an OpenAPI spec - a page per operation, grouped by tag.',
148
+ 'NavigationItem.openapi.src': 'Path of the OpenAPI spec file, relative to writedocs.json.',
149
+ 'NavigationItem.openapi.path': 'URL path the generated pages go under, like "/api". Each OpenAPI group needs its own.',
150
+ 'NavigationItem.label': 'Link text in the sidebar.',
151
+ 'NavigationItem.href': 'Where the link goes.',
152
+ ...Object.fromEntries(containerEntries),
153
+
154
+ socials: 'Icon links in the footer: platform -> URL, like { "github": "https://github.com/acme" }. The key is also the icon.',
155
+ topbar: 'The topbar.',
156
+ 'topbar.links': 'Links at the right of the topbar.',
157
+ ...link('topbar.links[]'),
158
+ footer: 'The footer: columns of links, and the `socials` icons.',
159
+ 'footer.columns': 'Columns of links.',
160
+ 'footer.columns[].title': 'The column\'s heading. Optional.',
161
+ 'footer.columns[].links': 'The links in the column.',
162
+ ...link('footer.columns[].links[]'),
163
+ ...logo('footer.logo'),
164
+
165
+ api: 'The API playground.',
166
+ 'api.proxy': 'When the browser blocks a "Try it" request (the API doesn\'t allow calls from other sites - CORS), retry it through writedocs\' proxy. Requests always go to the API directly first. Default true.',
167
+ domain: 'The site\'s address, like "docs.example.com". Turns on sitemap.xml and absolute URLs in link previews.',
168
+ basePath: 'The path the site is served under, like "/docs" for example.com/docs - usually behind your own proxy. Every address the site makes starts with it, and the build writes the site to dist/docs/. Starts with "/", no "/" at the end; lowercase letters, digits, "-" and "_". Default: none, the site at the root.',
169
+
170
+ seo: 'Default metadata for every page. A page\'s own `seo` frontmatter overrides it field by field.',
171
+ 'seo.ogImage': 'Image shown in link previews - a path or a full URL.',
172
+ 'seo.generatedOgImage': 'Whether a page without an `ogImage` gets a link preview image generated at build time. Default true; set false to skip them, which shortens the build of a large site.',
173
+ 'seo.ogType': 'The og:type of pages. Default "website".',
174
+ 'seo.twitterCard': 'X/Twitter card style. Default "summary_large_image" with an `ogImage`, "summary" without.',
175
+ 'seo.keywords': 'Keywords for the <meta name="keywords"> tag.',
176
+ 'seo.noindex': 'Ask search engines not to index pages, and leave them out of sitemap.xml.',
177
+ 'seo.robots': 'The whole <meta name="robots"> value, like "noindex, follow". Replaces `noindex`; a value with "noindex" leaves pages out of sitemap.xml too.',
178
+ 'seo.organization': 'Who publishes the site, for search engines: an Organization in the home page\'s structured data, and the publisher of every page.',
179
+ 'seo.organization.name': 'The organization\'s name, like "Acme".',
180
+ 'seo.organization.url': 'The organization\'s own site. Default: this site\'s address.',
181
+ 'seo.organization.logo': 'Its logo - a path or a full URL. Default: the site\'s logo.',
182
+ 'seo.organization.sameAs': 'Its profiles on other sites. Default: the URLs in `socials`.',
183
+ 'seo.metatags':'Other <meta> tags, name to content - like { "google-site-verification": "..." }. One with the name of a tag writedocs writes ("og:image", "twitter:image") replaces it.',
184
+ contextMenu: 'The "Copy page" menu on every page - copy as Markdown, view as Markdown, open in ChatGPT, Claude or Perplexity, copy the MCP server URL, connect to Cursor or VS Code - and a Markdown copy of each page at its address + ".md". On by default with every option (the MCP ones only while `mcp` is on). A list picks the options ("copy", "view", "chatgpt", "claude", "perplexity", "mcp", "cursor", "vscode"); false turns it all off.',
185
+ 'contextMenu.openIn': 'The earlier form: which AI assistants the menu offers, besides copy and view. A list of options replaces it.',
186
+ mcp: 'An MCP server at /mcp, so AI tools can search and read the docs. The build adds its index and a Cloudflare-ready _worker.js to dist/. Default true; false leaves them out.',
187
+ redirects: 'Redirects from old addresses. Each matches one exact path.',
188
+ 'redirects[].source': 'The old path, like "/old-page".',
189
+ 'redirects[].destination': 'Where to send it, like "/docs/new-page/".',
190
+ variables: 'Values pages can insert with [[name]], like { "productName": "Acme" }.',
191
+ banner: 'A banner above the topbar on every page.',
192
+ 'banner.content': 'The banner\'s text. Markdown links work.',
193
+ 'banner.dismissible': 'Let readers close it. Default false.',
194
+ 'banner.type': 'Its color: "info", "warning" or "critical". Default "info".',
195
+ notFound: 'The 404 page.',
196
+ 'notFound.title': 'The 404 page\'s title.',
197
+ 'notFound.description': 'Text under the title on the 404 page.',
198
+ scripts: 'Scripts added to every page - for tools `integrations` doesn\'t cover.',
199
+ 'scripts.head': 'Scripts added at the end of <head>.',
200
+ ...script('scripts.head[]'),
201
+ 'scripts.body': 'Scripts added at the end of <body>.',
202
+ ...script('scripts.body[]'),
203
+
204
+ integrations: 'Analytics and chat tools.',
205
+ 'integrations.ga4': 'Google Analytics 4.',
206
+ 'integrations.ga4.measurementId': 'Measurement ID, like "G-XXXXXXXXXX".',
207
+ 'integrations.googleTagManager': 'Google Tag Manager.',
208
+ 'integrations.googleTagManager.containerId': 'Container ID, like "GTM-XXXXXXX".',
209
+ 'integrations.plausible': 'Plausible Analytics.',
210
+ 'integrations.plausible.domain': 'The site\'s domain, as registered in Plausible.',
211
+ 'integrations.plausible.src': 'Script URL, for a self-hosted Plausible. Default "https://plausible.io/js/script.js".',
212
+ 'integrations.fathom': 'Fathom Analytics.',
213
+ 'integrations.fathom.siteId': 'Fathom\'s site ID, like "ABCDEFGH".',
214
+ 'integrations.posthog': 'PostHog.',
215
+ 'integrations.posthog.apiKey': 'Project API key, starting with "phc_".',
216
+ 'integrations.posthog.apiHost': 'API host. Default "https://us.i.posthog.com" - use yours for EU cloud or self-hosting.',
217
+ 'integrations.umami': 'Umami Analytics.',
218
+ 'integrations.umami.websiteId': 'Umami\'s website ID.',
219
+ 'integrations.umami.src': 'Script URL. Default "https://cloud.umami.is/script.js" - use yours when self-hosting.',
220
+ 'integrations.askAi': 'AI chat over the docs, with DocsBot.',
221
+ 'integrations.askAi.id': 'DocsBot\'s "teamId/botId". The WRITEDOCS_ASK_AI_ID environment variable overrides it.',
222
+ 'integrations.consent': 'A consent banner: the analytics integrations load only once the reader accepts. true uses the default texts; an object changes them.',
223
+ 'integrations.consent.message': 'The banner\'s text.',
224
+ 'integrations.consent.acceptLabel': 'The accept button\'s text. Default "Accept".',
225
+ 'integrations.consent.declineLabel': 'The decline button\'s text. Default "Decline".',
226
+ 'integrations.consent.policyUrl': 'A link after the text, to your privacy or cookie policy.',
227
+ 'integrations.consent.policyLabel': 'That link\'s text. Default "Privacy policy".',
228
+ };