@writedocs/generator 0.13.4 → 0.14.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.
Files changed (89) hide show
  1. package/README.md +28 -28
  2. package/astro.config.mjs +645 -645
  3. package/bin/writedocs.js +359 -356
  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 +223 -203
  8. package/src/cli/check-built-styles.js +41 -41
  9. package/src/cli/convert.js +124 -124
  10. package/src/cli/dev.js +269 -268
  11. package/src/cli/exit-when-flushed.js +42 -42
  12. package/src/cli/generate-api-pages.js +509 -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 +71 -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 +219 -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 +422 -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 +12 -1
  48. package/src/lib/config-schema.ts +2523 -2509
  49. package/src/lib/config.ts +1331 -1316
  50. package/src/lib/consent.js +108 -108
  51. package/src/lib/content-check.js +4 -1
  52. package/src/lib/content-store-reload-integration.js +101 -101
  53. package/src/lib/drafts.js +186 -0
  54. package/src/lib/icon-data-dev.js +53 -53
  55. package/src/lib/image-size.js +152 -152
  56. package/src/lib/json-schema-descriptions.js +228 -228
  57. package/src/lib/link-check.js +553 -544
  58. package/src/lib/llms-index.ts +90 -90
  59. package/src/lib/mcp-dev-integration.js +65 -65
  60. package/src/lib/mcp-index.ts +102 -102
  61. package/src/lib/mintlify-convert.js +605 -605
  62. package/src/lib/moved-api-pages.js +49 -49
  63. package/src/lib/og-cards.js +33 -33
  64. package/src/lib/og-image.js +235 -235
  65. package/src/lib/openapi-dev-status.js +80 -80
  66. package/src/lib/openapi-reload-integration.js +193 -193
  67. package/src/lib/pages.js +346 -312
  68. package/src/lib/project-files-integration.js +116 -116
  69. package/src/lib/project-files.js +137 -137
  70. package/src/lib/rehype-base-path.js +62 -62
  71. package/src/lib/rehype-image-loading.js +71 -71
  72. package/src/lib/robots-txt.js +21 -21
  73. package/src/lib/search-scope.js +44 -44
  74. package/src/lib/selector-placement.js +50 -50
  75. package/src/lib/seo-tags.js +157 -155
  76. package/src/lib/shiki-code-block.js +7 -1
  77. package/src/lib/site-base.ts +27 -27
  78. package/src/lib/styles-asset-integration.js +291 -291
  79. package/src/lib/wdignore-cases.json +195 -195
  80. package/src/lib/wdignore.js +177 -177
  81. package/src/pages/404.astro +63 -63
  82. package/src/pages/[...slug].astro +1773 -1608
  83. package/src/pages/[...slug].md.ts +93 -93
  84. package/src/pages/llms-full.txt.ts +88 -88
  85. package/src/pages/og/[...slug].png.ts +63 -63
  86. package/src/scripts/mobile-menu.ts +80 -80
  87. package/src/scripts/search.ts +245 -245
  88. package/src/scripts/sidebar-scroll.ts +61 -61
  89. package/src/styles/global.css +40 -40
@@ -1,326 +1,332 @@
1
- /* Base element styles + the .wd-shell three-column layout (sidebar / main
2
- / toc) - imported once by BaseLayout.astro. Everything here consumes the
3
- semantic --wd-* custom properties (--wd-primary, --wd-background, etc.)
4
- set on :root by BaseLayout's own inline <style define:vars> block, not
5
- the raw wdPrimaryLight/wdPrimaryDark values themselves - so, unlike that
6
- block, none of this needs to live inside an .astro file's own scoped
7
- <style> to work. A plain imported .css file is never scoped by Astro in
8
- the first place, so every selector below is already effectively global -
9
- no :global() wrapper needed (and, if left in by mistake, :global(...) is
10
- not valid CSS outside Astro's own scoped-<style> processing, so a rule
11
- written that way here would just silently never match anything). */
12
-
13
- * {
14
- box-sizing: border-box;
15
- }
16
- body {
17
- margin: 0;
18
- /* Sticky-footer layout: body is the flex column, .wd-page (everything
19
- above the footer - banner/topbar/.wd-shell, see BaseLayout.astro) is
20
- its flex: 1 0 auto item below, and <footer class="wd-footer"> is a
21
- plain sibling after it - on a page short enough not to need
22
- scrolling, .wd-page's flex-grow fills the leftover space down to the
23
- viewport's bottom edge, pushing the footer flush against it (rather
24
- than the footer trailing right after a half-empty page with its own
25
- background peeking through beneath it); on a page tall enough to
26
- already fill/exceed the viewport, .wd-page just settles at its own
27
- natural (larger) height and the footer trails normally at the real
28
- end of the document, exactly as before this rule existed. Doesn't
29
- apply in `mode: "blank"` (no .wd-page wrapper, no footer at all in
30
- that branch - see BaseLayout.astro) - a blank page already controls
31
- 100% of its own layout.
32
- */
33
- display: flex;
34
- flex-direction: column;
35
- min-height: 100vh;
36
- /* theme.background (writedocs.json) - --wd-page-bg-color/--wd-page-bg-image
37
- default to the same value as --wd-background/'none' (see
38
- BaseLayout.astro's lightPageBgColor/lightPageBgImage resolution), so
39
- an unconfigured site renders identically to a plain background: var(
40
- --wd-background) rule. background-attachment: fixed keeps a
41
- configured image sized to the viewport rather than the full
42
- (possibly very tall) document - the more expected look for a
43
- decorative page background, not something that stretches/tiles
44
- across a long scrolling doc. The topbar and footer each get their
45
- own explicit opaque background (topbar.css, footer.css)
46
- specifically so this doesn't show through them - the sidebar, main
47
- content, and toc columns all have no background of their own, so a
48
- configured page background/image shows through all three. */
49
- background-color: var(--wd-page-bg-color);
50
- background-image: var(--wd-page-bg-image);
51
- background-size: cover;
52
- background-position: center;
53
- background-repeat: no-repeat;
54
- background-attachment: fixed;
55
- color: var(--wd-text);
56
- /* --wd-font-family-body/--wd-font-family (BaseLayout.astro's own
57
- define:vars <style> block, driven by theme.fonts - see
58
- resolveFonts()/fontsSchema in lib/config.ts) are always both set to a
59
- real, already-resolved font stack, never left for this rule's own
60
- fallback to cover - an unconfigured site still resolves to Inter here
61
- (genuinely loaded via a Google Fonts <link>, not just named as a
62
- fallback the way this line used to work before theme.fonts existed).
63
- The literal fallback stack below only matters in the narrow window
64
- before that <style> block itself has been parsed. */
65
- font-family: var(--wd-font-family-body, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
66
- line-height: 1.6;
67
- }
68
- a {
69
- color: var(--wd-primary);
70
- }
71
- /* theme.fonts.heading (or the site-wide theme.fonts.family/Inter default,
72
- when no heading-specific override is configured - see
73
- --wd-font-family-heading's own resolution in BaseLayout.astro) - applies
74
- everywhere a heading renders (article prose, the auto-generated
75
- .wd-article-header h1, etc.), not just inside .wd-article specifically,
76
- since nothing site-wide should render headings in a different font by
77
- accident just because it happens to sit outside that one container. */
78
- h1,
79
- h2,
80
- h3,
81
- h4,
82
- h5,
83
- h6 {
84
- font-family: var(--wd-font-family-heading, inherit);
85
- }
86
- /* A page's headings and bold text stand out over its body text (--wd-text).
87
- :where() keeps this at no specificity, so a component's own title color,
88
- or a page's own styles, still win - and it's scoped to the page's article,
89
- so hand-built `mode: custom` pages keep inheriting their own colors. */
90
- :where(.wd-article, .wd-article-header) :where(h1, h2, h3, h4, h5, h6, strong, b) {
91
- color: var(--wd-heading);
92
- }
93
- code {
94
- background: var(--wd-surface);
95
- border: 1px solid var(--wd-border);
96
- padding: 0.15em 0.45em;
97
- border-radius: 0.35em;
98
- font-size: 1em;
99
- font-weight: 500;
100
- }
101
- pre code {
102
- background: none;
103
- border: none;
104
- padding: 0;
105
- font-weight: normal;
106
- }
107
- pre {
108
- padding: 1rem;
109
- border-radius: 0.5rem;
110
- overflow-x: auto;
111
- }
112
-
113
- /* flex: 1 0 auto (not the shorthand `flex: 1` main.wd-shell below also
114
- uses) so this never shrinks below its own natural content height even
115
- inside a flex *column* ancestor shorter than that - see body's own
116
- comment above for the sticky-footer layout this is the growing half
117
- of. */
118
- .wd-page {
119
- display: flex;
120
- flex-direction: column;
121
- flex: 1 0 auto;
122
- }
123
- .wd-shell {
124
- display: flex;
125
- max-width: 1440px;
126
- margin: 0 auto;
127
- width: 100%;
128
- /* Grows to fill .wd-page's remaining height (after the banner/topbar
129
- above it take their own natural height) on a short page - see body's
130
- comment above. .wd-sidebar-col/.wd-toc-col below then stretch to
131
- match *this* element's own height for free, via flexbox's own
132
- default `align-items: stretch` on a row - no min-height of their own
133
- needed (this replaces one on .wd-sidebar-col that used to hardcode
134
- 100vh instead, which overshot on a page with a banner/tall topbar
135
- above it, or undershot the real page height on a page taller than
136
- one viewport). */
137
- flex: 1;
138
- }
139
- .wd-sidebar-col {
140
- width: 260px;
141
- flex-shrink: 0;
142
- border-right: 1px solid var(--wd-border);
143
- }
144
- .wd-main-col {
145
- flex: 1;
146
- min-width: 0;
147
- }
148
- .wd-toc-col {
149
- width: 230px;
150
- flex-shrink: 0;
151
- border-left: 1px solid var(--wd-border);
152
- }
153
- @media (max-width: 1150px) {
154
- .wd-toc-col {
155
- display: none;
156
- }
157
- }
158
- @media (max-width: 860px) {
159
- .wd-shell {
160
- flex-direction: column;
161
- }
162
- /* The sidebar doesn't stack full-width above the page content at this
163
- width - it's shown in MobileMenu.astro's panel instead, which the
164
- menu's script moves it into when it opens (src/scripts/mobile-menu.ts).
165
- Its column just disappears. */
166
- .wd-sidebar-col {
167
- display: none;
168
- }
169
- /* Sidebar.astro's .wd-sidebar is sticky-with-its-own-scrollbar on wide
170
- screens (see its own style block for why) - not appropriate inside
171
- MobileMenu.astro's panel, which already has its own scroll area; this
172
- makes it flow as a plain block
173
- there instead of trying to run a second, nested one. This selector
174
- reaches into Sidebar.astro's own scoped class from a plain external
175
- stylesheet - works with no special syntax needed (unlike the
176
- :global() wrapper this rule needed back when it lived in BaseLayout's
177
- own scoped <style> block), since a plain .css file was never scoped
178
- to begin with. */
179
- .wd-sidebar {
180
- position: static;
181
- max-height: none;
182
- overflow-y: visible;
183
- }
184
- }
185
-
186
- /* Dual light/dark logo: both <img> tags are always in the markup (see
187
- TopBar.astro/MobileMenu.astro/SiteFooter.astro, all three of which
188
- render this same pair), CSS shows only the one matching the active
189
- [data-theme] - set by the inline anti-FOUC script in BaseLayout's
190
- <head> + the theme-toggle click handler (src/scripts/theme-toggle.ts).
191
- A site that only gave one logo path gets the same <img> rendered twice
192
- with both classes worth of visibility rules, i.e. it's just always
193
- shown. Kept here (not co-located with any one of the three components
194
- above) since all three need it identically. */
195
- .wd-logo-dark {
196
- display: none;
197
- }
198
- [data-theme="dark"] .wd-logo-light {
199
- display: none;
200
- }
201
- [data-theme="dark"] .wd-logo-dark {
202
- display: block;
203
- }
204
-
205
- /* Same dual-image/CSS-toggle mechanism as the logo pair above, for the
206
- "Powered by writedocs" sidebar watermark (Sidebar.astro) - kept as
207
- plain global rules here rather than a `:global()`-wrapped selector
208
- inside that component's own scoped <style> block, matching this
209
- proven pattern exactly instead of a second, more exotic variant of
210
- it. */
211
- .wd-watermark-dark {
212
- display: none;
213
- }
214
- [data-theme="dark"] .wd-watermark-light {
215
- display: none;
216
- }
217
- [data-theme="dark"] .wd-watermark-dark {
218
- display: block;
219
- }
220
-
221
- /* Astro's Shiki output (both the built-in MDX code-fence pipeline,
222
- configured with dual themes in astro.config.mjs, and the <Code />
223
- component used for the API playground's request/response snippets)
224
- bakes the "light" theme as each element's base color/background and
225
- stashes the dark equivalents in --shiki-dark/--shiki-dark-bg custom
226
- properties. Swapping to those on [data-theme='dark'] is the officially
227
- documented way to make Shiki-highlighted code follow a manual
228
- (non-media-query) theme toggle - see
229
- https://docs.astro.build/en/guides/syntax-highlighting/#setting-light-and-dark-mode-themes.
230
- Site-wide/article-content concern, unrelated to any one layout
231
- component, which is why it lives here rather than in any of the
232
- feature-specific stylesheets. */
233
- [data-theme="dark"] .astro-code,
234
- [data-theme="dark"] .astro-code span {
235
- color: var(--shiki-dark) !important;
236
- background-color: var(--shiki-dark-bg) !important;
237
- font-style: var(--shiki-dark-font-style) !important;
238
- font-weight: var(--shiki-dark-font-weight) !important;
239
- text-decoration: var(--shiki-dark-text-decoration) !important;
240
- }
241
-
242
- /* An icon given as an image URL or path (resolveIcon()'s 'image' kind,
243
- rendered by AppIcon.astro) - 1em square inside its caller's own icon
244
- span, so it sizes like a glyph icon would. Lives here rather than in
245
- AppIcon.astro so it's part of the shared stylesheet, not an inline
246
- <style> added to every page. */
247
- /* An image the build gave its file's width and height
248
- (lib/rehype-image-loading.js): those attributes reserve its place while
249
- it loads, and this keeps its height following its width when it's shown
250
- narrower than the file - without it, the height attribute would stretch
251
- it. :where() adds no specificity, so any rule that sets a height wins. */
252
- /* The note for AI agents at the top of every page (lib/agent-directive.js):
253
- in the HTML, where an agent reads it, and out of sight. Clipped rather
254
- than display: none, which HTML-to-text converters often drop. */
255
- .wd-agent-note {
256
- position: absolute;
257
- width: 1px;
258
- height: 1px;
259
- margin: -1px;
260
- padding: 0;
261
- overflow: hidden;
262
- clip: rect(0 0 0 0);
263
- clip-path: inset(50%);
264
- white-space: nowrap;
265
- border: 0;
266
- }
267
- /* The logo has a width beside its height (logoWidth(), lib/image-size.js)
268
- so its place is kept while it loads. `width: auto` lets a site's own CSS
269
- change its height without squeezing it - the two attributes still tell
270
- the browser its proportions. */
271
- :where(.wd-logo-light, .wd-logo-dark) {
272
- width: auto;
273
- }
274
- :where(img[data-wd-sized]) {
275
- height: auto;
276
- }
277
- img.wd-icon-img {
278
- display: block;
279
- width: 1em;
280
- height: 1em;
281
- object-fit: contain;
282
- }
283
-
284
- /* Scrollbars of the columns beside the page - the sidebar, the table of
285
- contents, the mobile menu and its option lists: a thin pill in the
286
- site's muted text color on no track, faint while the pointer is
287
- elsewhere, clearer over the column, strongest on the pill itself.
288
- Chromium and Safari draw it from the ::-webkit-scrollbar rules (the
289
- standard scrollbar-color/-width would switch those off in Chromium, and
290
- can't make it this thin); Firefox, which has only the standard ones,
291
- gets its thin scrollbar in the same colors. */
292
- :root {
293
- --wd-scrollbar-thumb: color-mix(in srgb, var(--wd-text-muted) 22%, transparent);
294
- --wd-scrollbar-thumb-near: color-mix(in srgb, var(--wd-text-muted) 45%, transparent);
295
- --wd-scrollbar-thumb-active: color-mix(in srgb, var(--wd-text-muted) 70%, transparent);
296
- }
297
- :is(.wd-sidebar, .wd-toc, .wd-mobile-menu-scroll, .wd-mobile-accordion-options-panel)::-webkit-scrollbar {
298
- width: 10px;
299
- height: 10px;
300
- }
301
- :is(.wd-sidebar, .wd-toc, .wd-mobile-menu-scroll, .wd-mobile-accordion-options-panel)::-webkit-scrollbar-track {
302
- background: transparent;
303
- }
304
- :is(.wd-sidebar, .wd-toc, .wd-mobile-menu-scroll, .wd-mobile-accordion-options-panel)::-webkit-scrollbar-thumb {
305
- background: var(--wd-scrollbar-thumb);
306
- /* A 6px pill with 2px of air on each side - off the column's border line. */
307
- border: 2px solid transparent;
308
- background-clip: padding-box;
309
- border-radius: 999px;
310
- }
311
- :is(.wd-sidebar, .wd-toc, .wd-mobile-menu-scroll, .wd-mobile-accordion-options-panel):hover::-webkit-scrollbar-thumb {
312
- background: var(--wd-scrollbar-thumb-near);
313
- }
314
- :is(.wd-sidebar, .wd-toc, .wd-mobile-menu-scroll, .wd-mobile-accordion-options-panel)::-webkit-scrollbar-thumb:hover,
315
- :is(.wd-sidebar, .wd-toc, .wd-mobile-menu-scroll, .wd-mobile-accordion-options-panel)::-webkit-scrollbar-thumb:active {
316
- background: var(--wd-scrollbar-thumb-active);
317
- }
318
- @supports not selector(::-webkit-scrollbar) {
319
- :is(.wd-sidebar, .wd-toc, .wd-mobile-menu-scroll, .wd-mobile-accordion-options-panel) {
320
- scrollbar-width: thin;
321
- scrollbar-color: var(--wd-scrollbar-thumb) transparent;
322
- }
323
- :is(.wd-sidebar, .wd-toc, .wd-mobile-menu-scroll, .wd-mobile-accordion-options-panel):hover {
324
- scrollbar-color: var(--wd-scrollbar-thumb-near) transparent;
325
- }
326
- }
1
+ /* Base element styles + the .wd-shell three-column layout (sidebar / main
2
+ / toc) - imported once by BaseLayout.astro. Everything here consumes the
3
+ semantic --wd-* custom properties (--wd-primary, --wd-background, etc.)
4
+ set on :root by BaseLayout's own inline <style define:vars> block, not
5
+ the raw wdPrimaryLight/wdPrimaryDark values themselves - so, unlike that
6
+ block, none of this needs to live inside an .astro file's own scoped
7
+ <style> to work. A plain imported .css file is never scoped by Astro in
8
+ the first place, so every selector below is already effectively global -
9
+ no :global() wrapper needed (and, if left in by mistake, :global(...) is
10
+ not valid CSS outside Astro's own scoped-<style> processing, so a rule
11
+ written that way here would just silently never match anything). */
12
+
13
+ * {
14
+ box-sizing: border-box;
15
+ }
16
+ body {
17
+ margin: 0;
18
+ /* Sticky-footer layout: body is the flex column, .wd-page (everything
19
+ above the footer - banner/topbar/.wd-shell, see BaseLayout.astro) is
20
+ its flex: 1 0 auto item below, and <footer class="wd-footer"> is a
21
+ plain sibling after it - on a page short enough not to need
22
+ scrolling, .wd-page's flex-grow fills the leftover space down to the
23
+ viewport's bottom edge, pushing the footer flush against it (rather
24
+ than the footer trailing right after a half-empty page with its own
25
+ background peeking through beneath it); on a page tall enough to
26
+ already fill/exceed the viewport, .wd-page just settles at its own
27
+ natural (larger) height and the footer trails normally at the real
28
+ end of the document, exactly as before this rule existed. Doesn't
29
+ apply in `mode: "blank"` (no .wd-page wrapper, no footer at all in
30
+ that branch - see BaseLayout.astro) - a blank page already controls
31
+ 100% of its own layout.
32
+ */
33
+ display: flex;
34
+ flex-direction: column;
35
+ min-height: 100vh;
36
+ /* theme.background (writedocs.json) - --wd-page-bg-color/--wd-page-bg-image
37
+ default to the same value as --wd-background/'none' (see
38
+ BaseLayout.astro's lightPageBgColor/lightPageBgImage resolution), so
39
+ an unconfigured site renders identically to a plain background: var(
40
+ --wd-background) rule. background-attachment: fixed keeps a
41
+ configured image sized to the viewport rather than the full
42
+ (possibly very tall) document - the more expected look for a
43
+ decorative page background, not something that stretches/tiles
44
+ across a long scrolling doc. The topbar and footer each get their
45
+ own explicit opaque background (topbar.css, footer.css)
46
+ specifically so this doesn't show through them - the sidebar, main
47
+ content, and toc columns all have no background of their own, so a
48
+ configured page background/image shows through all three. */
49
+ background-color: var(--wd-page-bg-color);
50
+ background-image: var(--wd-page-bg-image);
51
+ background-size: cover;
52
+ background-position: center;
53
+ background-repeat: no-repeat;
54
+ background-attachment: fixed;
55
+ color: var(--wd-text);
56
+ /* --wd-font-family-body/--wd-font-family (BaseLayout.astro's own
57
+ define:vars <style> block, driven by theme.fonts - see
58
+ resolveFonts()/fontsSchema in lib/config.ts) are always both set to a
59
+ real, already-resolved font stack, never left for this rule's own
60
+ fallback to cover - an unconfigured site still resolves to Inter here
61
+ (genuinely loaded via a Google Fonts <link>, not just named as a
62
+ fallback the way this line used to work before theme.fonts existed).
63
+ The literal fallback stack below only matters in the narrow window
64
+ before that <style> block itself has been parsed. */
65
+ font-family: var(--wd-font-family-body, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
66
+ line-height: 1.6;
67
+ }
68
+ a {
69
+ color: var(--wd-primary);
70
+ }
71
+ /* theme.fonts.heading (or the site-wide theme.fonts.family/Inter default,
72
+ when no heading-specific override is configured - see
73
+ --wd-font-family-heading's own resolution in BaseLayout.astro) - applies
74
+ everywhere a heading renders (article prose, the auto-generated
75
+ .wd-article-header h1, etc.), not just inside .wd-article specifically,
76
+ since nothing site-wide should render headings in a different font by
77
+ accident just because it happens to sit outside that one container. */
78
+ h1,
79
+ h2,
80
+ h3,
81
+ h4,
82
+ h5,
83
+ h6 {
84
+ font-family: var(--wd-font-family-heading, inherit);
85
+ }
86
+ /* A page's headings and bold text stand out over its body text (--wd-text).
87
+ :where() keeps this at no specificity, so a component's own title color,
88
+ or a page's own styles, still win - and it's scoped to the page's article,
89
+ so hand-built `mode: custom` pages keep inheriting their own colors. */
90
+ :where(.wd-article, .wd-article-header) :where(h1, h2, h3, h4, h5, h6, strong, b) {
91
+ color: var(--wd-heading);
92
+ }
93
+ code {
94
+ background: var(--wd-surface);
95
+ border: 1px solid var(--wd-border);
96
+ padding: 0.15em 0.45em;
97
+ border-radius: 0.35em;
98
+ font-size: 1em;
99
+ font-weight: 500;
100
+ }
101
+ pre code {
102
+ background: none;
103
+ border: none;
104
+ padding: 0;
105
+ font-weight: normal;
106
+ }
107
+ pre {
108
+ padding: 1rem;
109
+ border-radius: 0.5rem;
110
+ overflow-x: auto;
111
+ }
112
+
113
+ /* flex: 1 0 auto (not the shorthand `flex: 1` main.wd-shell below also
114
+ uses) so this never shrinks below its own natural content height even
115
+ inside a flex *column* ancestor shorter than that - see body's own
116
+ comment above for the sticky-footer layout this is the growing half
117
+ of. */
118
+ .wd-page {
119
+ display: flex;
120
+ flex-direction: column;
121
+ flex: 1 0 auto;
122
+ }
123
+ .wd-shell {
124
+ display: flex;
125
+ max-width: 1440px;
126
+ margin: 0 auto;
127
+ width: 100%;
128
+ /* Grows to fill .wd-page's remaining height (after the banner/topbar
129
+ above it take their own natural height) on a short page - see body's
130
+ comment above. .wd-sidebar-col/.wd-toc-col below then stretch to
131
+ match *this* element's own height for free, via flexbox's own
132
+ default `align-items: stretch` on a row - no min-height of their own
133
+ needed (this replaces one on .wd-sidebar-col that used to hardcode
134
+ 100vh instead, which overshot on a page with a banner/tall topbar
135
+ above it, or undershot the real page height on a page taller than
136
+ one viewport). */
137
+ flex: 1;
138
+ }
139
+ .wd-sidebar-col {
140
+ width: 260px;
141
+ flex-shrink: 0;
142
+ border-right: 1px solid var(--wd-border);
143
+ }
144
+ .wd-main-col {
145
+ flex: 1;
146
+ min-width: 0;
147
+ }
148
+ .wd-toc-col {
149
+ width: 230px;
150
+ flex-shrink: 0;
151
+ border-left: 1px solid var(--wd-border);
152
+ }
153
+ @media (max-width: 1150px) {
154
+ .wd-toc-col {
155
+ display: none;
156
+ }
157
+ }
158
+ @media (max-width: 860px) {
159
+ .wd-shell {
160
+ flex-direction: column;
161
+ }
162
+ /* The sidebar doesn't stack full-width above the page content at this
163
+ width - it's shown in MobileMenu.astro's panel instead, which the
164
+ menu's script moves it into when it opens (src/scripts/mobile-menu.ts).
165
+ Its column just disappears. */
166
+ .wd-sidebar-col {
167
+ display: none;
168
+ }
169
+ /* Sidebar.astro's .wd-sidebar is sticky-with-its-own-scrollbar on wide
170
+ screens (see its own style block for why) - not appropriate inside
171
+ MobileMenu.astro's panel, which already has its own scroll area; this
172
+ makes it flow as a plain block
173
+ there instead of trying to run a second, nested one. This selector
174
+ reaches into Sidebar.astro's own scoped class from a plain external
175
+ stylesheet - works with no special syntax needed (unlike the
176
+ :global() wrapper this rule needed back when it lived in BaseLayout's
177
+ own scoped <style> block), since a plain .css file was never scoped
178
+ to begin with. */
179
+ .wd-sidebar {
180
+ position: static;
181
+ max-height: none;
182
+ overflow-y: visible;
183
+ }
184
+ }
185
+
186
+ /* Dual light/dark logo: both <img> tags are always in the markup (see
187
+ TopBar.astro/MobileMenu.astro/SiteFooter.astro, all three of which
188
+ render this same pair), CSS shows only the one matching the active
189
+ [data-theme] - set by the inline anti-FOUC script in BaseLayout's
190
+ <head> + the theme-toggle click handler (src/scripts/theme-toggle.ts).
191
+ A site that only gave one logo path gets the same <img> rendered twice
192
+ with both classes worth of visibility rules, i.e. it's just always
193
+ shown. Kept here (not co-located with any one of the three components
194
+ above) since all three need it identically. */
195
+ .wd-logo-dark {
196
+ display: none;
197
+ }
198
+ [data-theme="dark"] .wd-logo-light {
199
+ display: none;
200
+ }
201
+ [data-theme="dark"] .wd-logo-dark {
202
+ display: block;
203
+ }
204
+
205
+ /* Same dual-image/CSS-toggle mechanism as the logo pair above, for the
206
+ "Powered by writedocs" sidebar watermark (Sidebar.astro) - kept as
207
+ plain global rules here rather than a `:global()`-wrapped selector
208
+ inside that component's own scoped <style> block, matching this
209
+ proven pattern exactly instead of a second, more exotic variant of
210
+ it. */
211
+ .wd-watermark-dark {
212
+ display: none;
213
+ }
214
+ [data-theme="dark"] .wd-watermark-light {
215
+ display: none;
216
+ }
217
+ [data-theme="dark"] .wd-watermark-dark {
218
+ display: block;
219
+ }
220
+
221
+ /* Astro's Shiki output (both the built-in MDX code-fence pipeline,
222
+ configured with dual themes in astro.config.mjs, and the <Code />
223
+ component used for the API playground's request/response snippets)
224
+ bakes the "light" theme as each element's base color/background and
225
+ stashes the dark equivalents in --shiki-dark/--shiki-dark-bg custom
226
+ properties. Swapping to those on [data-theme='dark'] is the officially
227
+ documented way to make Shiki-highlighted code follow a manual
228
+ (non-media-query) theme toggle - see
229
+ https://docs.astro.build/en/guides/syntax-highlighting/#setting-light-and-dark-mode-themes.
230
+ Site-wide/article-content concern, unrelated to any one layout
231
+ component, which is why it lives here rather than in any of the
232
+ feature-specific stylesheets.
233
+ The background goes on the <pre> only: Shiki gives the spans inside no
234
+ background of their own, and painting the theme's background on every
235
+ span (.line included) covered the highlighted, diff, error and focus
236
+ line colors and the highlighted words in dark mode. */
237
+ [data-theme="dark"] .astro-code {
238
+ background-color: var(--shiki-dark-bg) !important;
239
+ }
240
+ [data-theme="dark"] .astro-code,
241
+ [data-theme="dark"] .astro-code span {
242
+ color: var(--shiki-dark) !important;
243
+ font-style: var(--shiki-dark-font-style) !important;
244
+ font-weight: var(--shiki-dark-font-weight) !important;
245
+ text-decoration: var(--shiki-dark-text-decoration) !important;
246
+ }
247
+
248
+ /* An icon given as an image URL or path (resolveIcon()'s 'image' kind,
249
+ rendered by AppIcon.astro) - 1em square inside its caller's own icon
250
+ span, so it sizes like a glyph icon would. Lives here rather than in
251
+ AppIcon.astro so it's part of the shared stylesheet, not an inline
252
+ <style> added to every page. */
253
+ /* An image the build gave its file's width and height
254
+ (lib/rehype-image-loading.js): those attributes reserve its place while
255
+ it loads, and this keeps its height following its width when it's shown
256
+ narrower than the file - without it, the height attribute would stretch
257
+ it. :where() adds no specificity, so any rule that sets a height wins. */
258
+ /* The note for AI agents at the top of every page (lib/agent-directive.js):
259
+ in the HTML, where an agent reads it, and out of sight. Clipped rather
260
+ than display: none, which HTML-to-text converters often drop. */
261
+ .wd-agent-note {
262
+ position: absolute;
263
+ width: 1px;
264
+ height: 1px;
265
+ margin: -1px;
266
+ padding: 0;
267
+ overflow: hidden;
268
+ clip: rect(0 0 0 0);
269
+ clip-path: inset(50%);
270
+ white-space: nowrap;
271
+ border: 0;
272
+ }
273
+ /* The logo has a width beside its height (logoWidth(), lib/image-size.js)
274
+ so its place is kept while it loads. `width: auto` lets a site's own CSS
275
+ change its height without squeezing it - the two attributes still tell
276
+ the browser its proportions. */
277
+ :where(.wd-logo-light, .wd-logo-dark) {
278
+ width: auto;
279
+ }
280
+ :where(img[data-wd-sized]) {
281
+ height: auto;
282
+ }
283
+ img.wd-icon-img {
284
+ display: block;
285
+ width: 1em;
286
+ height: 1em;
287
+ object-fit: contain;
288
+ }
289
+
290
+ /* Scrollbars of the columns beside the page - the sidebar, the table of
291
+ contents, the mobile menu and its option lists: a thin pill in the
292
+ site's muted text color on no track, faint while the pointer is
293
+ elsewhere, clearer over the column, strongest on the pill itself.
294
+ Chromium and Safari draw it from the ::-webkit-scrollbar rules (the
295
+ standard scrollbar-color/-width would switch those off in Chromium, and
296
+ can't make it this thin); Firefox, which has only the standard ones,
297
+ gets its thin scrollbar in the same colors. */
298
+ :root {
299
+ --wd-scrollbar-thumb: color-mix(in srgb, var(--wd-text-muted) 22%, transparent);
300
+ --wd-scrollbar-thumb-near: color-mix(in srgb, var(--wd-text-muted) 45%, transparent);
301
+ --wd-scrollbar-thumb-active: color-mix(in srgb, var(--wd-text-muted) 70%, transparent);
302
+ }
303
+ :is(.wd-sidebar, .wd-toc, .wd-mobile-menu-scroll, .wd-mobile-accordion-options-panel)::-webkit-scrollbar {
304
+ width: 10px;
305
+ height: 10px;
306
+ }
307
+ :is(.wd-sidebar, .wd-toc, .wd-mobile-menu-scroll, .wd-mobile-accordion-options-panel)::-webkit-scrollbar-track {
308
+ background: transparent;
309
+ }
310
+ :is(.wd-sidebar, .wd-toc, .wd-mobile-menu-scroll, .wd-mobile-accordion-options-panel)::-webkit-scrollbar-thumb {
311
+ background: var(--wd-scrollbar-thumb);
312
+ /* A 6px pill with 2px of air on each side - off the column's border line. */
313
+ border: 2px solid transparent;
314
+ background-clip: padding-box;
315
+ border-radius: 999px;
316
+ }
317
+ :is(.wd-sidebar, .wd-toc, .wd-mobile-menu-scroll, .wd-mobile-accordion-options-panel):hover::-webkit-scrollbar-thumb {
318
+ background: var(--wd-scrollbar-thumb-near);
319
+ }
320
+ :is(.wd-sidebar, .wd-toc, .wd-mobile-menu-scroll, .wd-mobile-accordion-options-panel)::-webkit-scrollbar-thumb:hover,
321
+ :is(.wd-sidebar, .wd-toc, .wd-mobile-menu-scroll, .wd-mobile-accordion-options-panel)::-webkit-scrollbar-thumb:active {
322
+ background: var(--wd-scrollbar-thumb-active);
323
+ }
324
+ @supports not selector(::-webkit-scrollbar) {
325
+ :is(.wd-sidebar, .wd-toc, .wd-mobile-menu-scroll, .wd-mobile-accordion-options-panel) {
326
+ scrollbar-width: thin;
327
+ scrollbar-color: var(--wd-scrollbar-thumb) transparent;
328
+ }
329
+ :is(.wd-sidebar, .wd-toc, .wd-mobile-menu-scroll, .wd-mobile-accordion-options-panel):hover {
330
+ scrollbar-color: var(--wd-scrollbar-thumb-near) transparent;
331
+ }
332
+ }