@writedocs/generator 0.11.1 → 0.13.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.
@@ -1,189 +1,203 @@
1
- import { defineCollection } from 'astro:content';
2
- import { glob } from 'astro/loaders';
3
- import type { Loader } from 'astro/loaders';
4
- import fs from 'node:fs';
5
- import path from 'node:path';
6
- import { fileURLToPath, pathToFileURL } from 'node:url';
7
- import { pageFrontmatterSchema, findAllPages } from './lib/config';
8
- import { titleFromPath } from './lib/pages.js';
9
- import { writedocsTempDir } from './lib/writedocs-temp-dir.js';
10
-
11
- const contentDir = process.env.WRITEDOCS_CONTENT_DIR || process.cwd();
12
-
13
- // Astro's glob loader resolves `base` via `new URL(base, root)`. On Windows,
14
- // a raw path string like "C:\foo\docs" gets misparsed by the WHATWG URL
15
- // parser (the drive letter "C:" looks like a URL scheme), which breaks
16
- // downstream `fileURLToPath` calls. Passing an explicit file:// URL sidesteps
17
- // that entirely and works the same on every platform.
18
- //
19
- // Auto-generated OpenAPI stub pages (see generate-api-pages.js) live under
20
- // writedocsTempDir() - an OS-temp-directory location keyed off contentDir,
21
- // not anywhere inside the content directory itself - so they never show up
22
- // mixed in with a site's own hand-written pages, and writedocs never writes
23
- // generated files into a person's own project folder. The same location is
24
- // also where build-time manifests/caches live - see writedocs-temp-dir.js's
25
- // own doc comment. A separate collection (rather than a second base folder
26
- // glued onto `pages` somehow) because Astro's loader API has no supported
27
- // way to point one collection's glob() at two base directories sharing a
28
- // single store without each call's own "delete anything I didn't just see"
29
- // cleanup wiping out the other's entries - [...slug].astro merges both
30
- // collections' entries back into one list at query time instead, which
31
- // sidesteps that entirely.
32
- const generatedDocsDir = path.join(writedocsTempDir(contentDir), 'generated-docs');
33
- const generatedDocsBase = pathToFileURL(generatedDocsDir + path.sep);
34
-
35
- // Page frontmatter - defined in lib/config-schema.ts as
36
- // pageFrontmatterSchema, next to writedocs.json's own schema, so
37
- // `writedocs validate` checks every page against exactly the schema the
38
- // build uses (that file compiles to the plain JS validate loads).
39
- const docsSchema = pageFrontmatterSchema;
40
-
41
- /** Wraps another loader so it's skipped entirely - no filesystem scan, no
42
- * "directory doesn't exist"/"no files found" warning - when its own base
43
- * directory doesn't exist yet. Astro requires every collection declared
44
- * in this file to have a loader, but most sites have no OpenAPI groups
45
- * at all (generate-api-pages.js only ever creates a generated-docs/
46
- * directory under writedocsTempDir() when at least one exists), so without this
47
- * the `generatedDocs` collection below would print a spurious warning on
48
- * every single build/dev run for the common case of a site with no
49
- * OpenAPI pages. */
50
- function skipIfMissing(inner: Loader): Loader {
51
- return {
52
- name: inner.name,
53
- load: async (context) => {
54
- if (!fs.existsSync(generatedDocsBase)) return;
55
- return inner.load(withTitleFallback(context));
56
- },
57
- };
58
- }
59
-
60
- // A page with no `title` in its frontmatter gets one from its file name,
61
- // before the schema (which requires `title`) sees it - Mintlify's rule, so
62
- // a migrated page that relied on it builds with the same title. See
63
- // titleFromPath() in lib/pages.js; `writedocs validate` applies the same
64
- // default (lib/content-check.js).
65
- type LoaderContext = Parameters<Loader['load']>[0];
66
- function withTitleFallback(context: LoaderContext): LoaderContext {
67
- return {
68
- ...context,
69
- parseData: (props) =>
70
- context.parseData({
71
- ...props,
72
- data:
73
- typeof props.data?.title === 'string'
74
- ? props.data
75
- : { ...props.data, title: titleFromPath(props.filePath ?? props.id) },
76
- }),
77
- };
78
- }
79
-
80
- const generatedDocs = defineCollection({
81
- loader: skipIfMissing(glob({ pattern: '**/*.{md,mdx}', base: generatedDocsBase })),
82
- schema: docsSchema,
83
- });
84
-
85
- // Every hand-written page in the project, wherever it lives - see
86
- // findAllPages() in lib/config.ts for the exact discovery rule (any
87
- // .md/.mdx file with a frontmatter block, the usual build/dependency
88
- // directories excluded - docs/ has no special status, it's scanned like
89
- // any other folder). A single collection covering the whole content
90
- // directory works here (unlike generatedDocs, which needs its own
91
- // separate collection - see that const's own comment) because there's
92
- // only one base to worry about: the content root itself.
93
- //
94
- // The literal file list (rather than a `**/*.{md,mdx}` pattern) is what
95
- // actually implements the frontmatter-based filter: glob()'s `pattern`
96
- // option takes glob patterns, not a predicate function, so the predicate
97
- // has to run first, here, to produce the list glob() then just matches
98
- // literally. Astro's own default id computation, scoped to this same
99
- // content-root base, is what gives a page under docs/ its "docs/..."
100
- // file id and a page at the root its bare file id - see
101
- // fileIdForEntry()'s own comment in lib/config.ts for the one place that
102
- // id computation needs to be independently recovered (once a page's
103
- // frontmatter `slug` has overridden `entry.id` itself).
104
- const contentRootBase = pathToFileURL(contentDir + path.sep);
105
-
106
- /** Wraps astro's own glob() loader so pages are re-discovered live during
107
- * `astro dev`, not just once when this module first evaluates.
108
- *
109
- * The naive approach - `glob({ pattern: findAllPages(contentDir), base })`,
110
- * computed once at module load, as this used to be - works fine for the
111
- * *first* load, but astro's glob loader's own dev-mode watcher only ever
112
- * matches entries against whatever literal pattern list it was constructed
113
- * with (see matchesGlob() in astro's glob.js, called from its `watcher.on(
114
- * 'add', ...)` handler): a file created after that list was computed can
115
- * never match it, so it silently never becomes a page until the dev server
116
- * is restarted and this module re-evaluates findAllPages() from scratch.
117
- * That's the exact bug this wrapper fixes.
118
- *
119
- * A plain wildcard pattern (`**\/*.{md,mdx}`) doesn't work as a substitute,
120
- * either: whether a given .md/.mdx file counts as a page at all depends on
121
- * its *content* (does it have a frontmatter block? - see findAllPages()'s
122
- * own doc comment, this is what lets e.g. snippets/ partials with no
123
- * frontmatter coexist in the content dir without becoming pages
124
- * themselves), not just its path, and glob()'s `pattern` option only does
125
- * path matching - it can't express that filter. Something has to re-run
126
- * findAllPages() itself, content and all, whenever the file set changes.
127
- *
128
- * So: this re-invokes astro's own glob() loader - reusing all of its real
129
- * parsing/rendering/digest-based caching logic rather than reimplementing
130
- * any of that - with a freshly recomputed literal file list every time
131
- * something relevant changes on disk, instead of once. The inner loader's
132
- * own watcher wiring is deliberately skipped each time (`watcher` is
133
- * stripped from the context passed to it) - this loader keeps exactly one
134
- * watcher subscription of its own instead, covering every case uniformly
135
- * (a new page file appearing, one being deleted, frontmatter being added
136
- * to or removed from an existing file, ordinary content edits) rather than
137
- * relying on the inner loader's add/change/unlink handlers, which - as
138
- * above - are only ever bound to whatever the pattern looked like at the
139
- * moment they were registered. */
140
- function livePages(dir: string, base: URL): Loader {
141
- return {
142
- name: 'writedocs-live-pages',
143
- load: async (context) => {
144
- const { watcher, store, logger } = context;
145
-
146
- async function resync() {
147
- const files = findAllPages(dir);
148
- if (files.length === 0) {
149
- // Mirrors the old skipIfEmpty() wrapper: skip calling the inner
150
- // loader entirely (rather than passing it an empty/impossible
151
- // pattern) so astro doesn't print its own "no files found"
152
- // warning for a freshly-scaffolded project with no content yet -
153
- // but still clear out any previously-synced entries, in case a
154
- // page's last file was just deleted mid dev-session rather than
155
- // this being the initial load of an empty project.
156
- for (const id of store.keys()) store.delete(id);
157
- return;
158
- }
159
- await glob({ pattern: files, base }).load({ ...withTitleFallback(context), watcher: undefined });
160
- }
161
-
162
- await resync();
163
- if (!watcher) return; // no watcher outside `astro dev` (e.g. `astro build`)
164
-
165
- watcher.add(fileURLToPath(base));
166
- let pending: ReturnType<typeof setTimeout> | undefined;
167
- const scheduleResync = (changedPath: string) => {
168
- if (!/\.mdx?$/i.test(changedPath)) return;
169
- clearTimeout(pending);
170
- // Debounced: an editor's "save" can fire several fs events in
171
- // quick succession (e.g. atomic-write = unlink+add), and adding
172
- // several files at once shouldn't trigger a resync per file.
173
- pending = setTimeout(() => {
174
- resync().catch((err) => logger.error(`Failed to reload pages: ${err.message}`));
175
- }, 100);
176
- };
177
- watcher.on('add', scheduleResync);
178
- watcher.on('unlink', scheduleResync);
179
- watcher.on('change', scheduleResync);
180
- },
181
- };
182
- }
183
-
184
- const pages = defineCollection({
185
- loader: livePages(contentDir, contentRootBase),
186
- schema: docsSchema,
187
- });
188
-
189
- export const collections = { pages, generatedDocs };
1
+ import { defineCollection } from 'astro:content';
2
+ import { glob } from 'astro/loaders';
3
+ import type { Loader } from 'astro/loaders';
4
+ import fs from 'node:fs';
5
+ import path from 'node:path';
6
+ import { fileURLToPath, pathToFileURL } from 'node:url';
7
+ import { pageFrontmatterSchema, findAllPages } from './lib/config';
8
+ import { titleFromPath } from './lib/pages.js';
9
+ import { writedocsTempDir } from './lib/writedocs-temp-dir.js';
10
+
11
+ const contentDir = process.env.WRITEDOCS_CONTENT_DIR || process.cwd();
12
+
13
+ // Astro's glob loader resolves `base` via `new URL(base, root)`. On Windows,
14
+ // a raw path string like "C:\foo\docs" gets misparsed by the WHATWG URL
15
+ // parser (the drive letter "C:" looks like a URL scheme), which breaks
16
+ // downstream `fileURLToPath` calls. Passing an explicit file:// URL sidesteps
17
+ // that entirely and works the same on every platform.
18
+ //
19
+ // Auto-generated OpenAPI stub pages (see generate-api-pages.js) live under
20
+ // writedocsTempDir() - an OS-temp-directory location keyed off contentDir,
21
+ // not anywhere inside the content directory itself - so they never show up
22
+ // mixed in with a site's own hand-written pages, and writedocs never writes
23
+ // generated files into a person's own project folder. The same location is
24
+ // also where build-time manifests/caches live - see writedocs-temp-dir.js's
25
+ // own doc comment. A separate collection (rather than a second base folder
26
+ // glued onto `pages` somehow) because Astro's loader API has no supported
27
+ // way to point one collection's glob() at two base directories sharing a
28
+ // single store without each call's own "delete anything I didn't just see"
29
+ // cleanup wiping out the other's entries - [...slug].astro merges both
30
+ // collections' entries back into one list at query time instead, which
31
+ // sidesteps that entirely.
32
+ const generatedDocsDir = path.join(writedocsTempDir(contentDir), 'generated-docs');
33
+ const generatedDocsBase = pathToFileURL(generatedDocsDir + path.sep);
34
+
35
+ // Page frontmatter - defined in lib/config-schema.ts as
36
+ // pageFrontmatterSchema, next to writedocs.json's own schema, so
37
+ // `writedocs validate` checks every page against exactly the schema the
38
+ // build uses (that file compiles to the plain JS validate loads).
39
+ const docsSchema = pageFrontmatterSchema;
40
+
41
+ /** Wraps another loader so it's skipped entirely - no filesystem scan, no
42
+ * "directory doesn't exist"/"no files found" warning - when its own base
43
+ * directory doesn't exist yet. Astro requires every collection declared
44
+ * in this file to have a loader, but most sites have no OpenAPI groups
45
+ * at all (generate-api-pages.js only ever creates a generated-docs/
46
+ * directory under writedocsTempDir() when at least one exists), so without this
47
+ * the `generatedDocs` collection below would print a spurious warning on
48
+ * every single build/dev run for the common case of a site with no
49
+ * OpenAPI pages.
50
+ *
51
+ * Without a watcher, in `writedocs dev` too: the collection is synced when
52
+ * the preview starts and then only when lib/openapi-reload-integration.js
53
+ * asks (refreshContent()), after writing the pages of an edited spec - in
54
+ * the order that keeps the navigation and the pages in step. A watcher of
55
+ * its own would sync each page file as it's written, at its own moment
56
+ * (and each refresh would add another set of its listeners). */
57
+ function skipIfMissing(inner: Loader): Loader {
58
+ return {
59
+ name: inner.name,
60
+ load: async (context) => {
61
+ if (!fs.existsSync(generatedDocsBase)) return;
62
+ // Left empty: the last spec taken out of writedocs.json while
63
+ // `writedocs dev` runs (the folder stays then). glob() would only warn
64
+ // about no files and keep the pages it had.
65
+ if (!fs.readdirSync(generatedDocsBase, { recursive: true }).some((file) => /\.mdx?$/i.test(String(file)))) {
66
+ for (const id of context.store.keys()) context.store.delete(id);
67
+ return;
68
+ }
69
+ return inner.load({ ...withTitleFallback(context), watcher: undefined });
70
+ },
71
+ };
72
+ }
73
+
74
+ // A page with no `title` in its frontmatter gets one from its file name,
75
+ // before the schema (which requires `title`) sees it - Mintlify's rule, so
76
+ // a migrated page that relied on it builds with the same title. See
77
+ // titleFromPath() in lib/pages.js; `writedocs validate` applies the same
78
+ // default (lib/content-check.js).
79
+ type LoaderContext = Parameters<Loader['load']>[0];
80
+ function withTitleFallback(context: LoaderContext): LoaderContext {
81
+ return {
82
+ ...context,
83
+ parseData: (props) =>
84
+ context.parseData({
85
+ ...props,
86
+ data:
87
+ typeof props.data?.title === 'string'
88
+ ? props.data
89
+ : { ...props.data, title: titleFromPath(props.filePath ?? props.id) },
90
+ }),
91
+ };
92
+ }
93
+
94
+ const generatedDocs = defineCollection({
95
+ loader: skipIfMissing(glob({ pattern: '**/*.{md,mdx}', base: generatedDocsBase })),
96
+ schema: docsSchema,
97
+ });
98
+
99
+ // Every hand-written page in the project, wherever it lives - see
100
+ // findAllPages() in lib/config.ts for the exact discovery rule (any
101
+ // .md/.mdx file with a frontmatter block, the usual build/dependency
102
+ // directories excluded - docs/ has no special status, it's scanned like
103
+ // any other folder). A single collection covering the whole content
104
+ // directory works here (unlike generatedDocs, which needs its own
105
+ // separate collection - see that const's own comment) because there's
106
+ // only one base to worry about: the content root itself.
107
+ //
108
+ // The literal file list (rather than a `**/*.{md,mdx}` pattern) is what
109
+ // actually implements the frontmatter-based filter: glob()'s `pattern`
110
+ // option takes glob patterns, not a predicate function, so the predicate
111
+ // has to run first, here, to produce the list glob() then just matches
112
+ // literally. Astro's own default id computation, scoped to this same
113
+ // content-root base, is what gives a page under docs/ its "docs/..."
114
+ // file id and a page at the root its bare file id - see
115
+ // fileIdForEntry()'s own comment in lib/config.ts for the one place that
116
+ // id computation needs to be independently recovered (once a page's
117
+ // frontmatter `slug` has overridden `entry.id` itself).
118
+ const contentRootBase = pathToFileURL(contentDir + path.sep);
119
+
120
+ /** Wraps astro's own glob() loader so pages are re-discovered live during
121
+ * `astro dev`, not just once when this module first evaluates.
122
+ *
123
+ * The naive approach - `glob({ pattern: findAllPages(contentDir), base })`,
124
+ * computed once at module load, as this used to be - works fine for the
125
+ * *first* load, but astro's glob loader's own dev-mode watcher only ever
126
+ * matches entries against whatever literal pattern list it was constructed
127
+ * with (see matchesGlob() in astro's glob.js, called from its `watcher.on(
128
+ * 'add', ...)` handler): a file created after that list was computed can
129
+ * never match it, so it silently never becomes a page until the dev server
130
+ * is restarted and this module re-evaluates findAllPages() from scratch.
131
+ * That's the exact bug this wrapper fixes.
132
+ *
133
+ * A plain wildcard pattern (`**\/*.{md,mdx}`) doesn't work as a substitute,
134
+ * either: whether a given .md/.mdx file counts as a page at all depends on
135
+ * its *content* (does it have a frontmatter block? - see findAllPages()'s
136
+ * own doc comment, this is what lets e.g. snippets/ partials with no
137
+ * frontmatter coexist in the content dir without becoming pages
138
+ * themselves), not just its path, and glob()'s `pattern` option only does
139
+ * path matching - it can't express that filter. Something has to re-run
140
+ * findAllPages() itself, content and all, whenever the file set changes.
141
+ *
142
+ * So: this re-invokes astro's own glob() loader - reusing all of its real
143
+ * parsing/rendering/digest-based caching logic rather than reimplementing
144
+ * any of that - with a freshly recomputed literal file list every time
145
+ * something relevant changes on disk, instead of once. The inner loader's
146
+ * own watcher wiring is deliberately skipped each time (`watcher` is
147
+ * stripped from the context passed to it) - this loader keeps exactly one
148
+ * watcher subscription of its own instead, covering every case uniformly
149
+ * (a new page file appearing, one being deleted, frontmatter being added
150
+ * to or removed from an existing file, ordinary content edits) rather than
151
+ * relying on the inner loader's add/change/unlink handlers, which - as
152
+ * above - are only ever bound to whatever the pattern looked like at the
153
+ * moment they were registered. */
154
+ function livePages(dir: string, base: URL): Loader {
155
+ return {
156
+ name: 'writedocs-live-pages',
157
+ load: async (context) => {
158
+ const { watcher, store, logger } = context;
159
+
160
+ async function resync() {
161
+ const files = findAllPages(dir);
162
+ if (files.length === 0) {
163
+ // Mirrors the old skipIfEmpty() wrapper: skip calling the inner
164
+ // loader entirely (rather than passing it an empty/impossible
165
+ // pattern) so astro doesn't print its own "no files found"
166
+ // warning for a freshly-scaffolded project with no content yet -
167
+ // but still clear out any previously-synced entries, in case a
168
+ // page's last file was just deleted mid dev-session rather than
169
+ // this being the initial load of an empty project.
170
+ for (const id of store.keys()) store.delete(id);
171
+ return;
172
+ }
173
+ await glob({ pattern: files, base }).load({ ...withTitleFallback(context), watcher: undefined });
174
+ }
175
+
176
+ await resync();
177
+ if (!watcher) return; // no watcher outside `astro dev` (e.g. `astro build`)
178
+
179
+ watcher.add(fileURLToPath(base));
180
+ let pending: ReturnType<typeof setTimeout> | undefined;
181
+ const scheduleResync = (changedPath: string) => {
182
+ if (!/\.mdx?$/i.test(changedPath)) return;
183
+ clearTimeout(pending);
184
+ // Debounced: an editor's "save" can fire several fs events in
185
+ // quick succession (e.g. atomic-write = unlink+add), and adding
186
+ // several files at once shouldn't trigger a resync per file.
187
+ pending = setTimeout(() => {
188
+ resync().catch((err) => logger.error(`Failed to reload pages: ${err.message}`));
189
+ }, 100);
190
+ };
191
+ watcher.on('add', scheduleResync);
192
+ watcher.on('unlink', scheduleResync);
193
+ watcher.on('change', scheduleResync);
194
+ },
195
+ };
196
+ }
197
+
198
+ const pages = defineCollection({
199
+ loader: livePages(contentDir, contentRootBase),
200
+ schema: docsSchema,
201
+ });
202
+
203
+ export const collections = { pages, generatedDocs };
@@ -818,9 +818,7 @@ const fontExtraCss = [fontFaceCss, fontFallbackCss, fontWeightCss].filter(Boolea
818
818
  logoLight={logoLight}
819
819
  logoDark={logoDark}
820
820
  brandLabel={brandLabel}
821
- >
822
- <slot name="sidebar" slot="sidebar" />
823
- </MobileMenu>
821
+ />
824
822
  <div class="wd-shell">
825
823
  {showSidebarCol && (
826
824
  <div class="wd-sidebar-col">
@@ -17,14 +17,13 @@
17
17
  // lib/config.ts, which walks the active PathSegment[] in that exact
18
18
  // order) - no tab-specific branching needed here at all.
19
19
  //
20
- // The sidebar itself is the `sidebar` slot, forwarded straight through
21
- // from whatever BaseLayout.astro received - rendered a second time
22
- // (Astro renders the same passed-in slot content at every place it's
23
- // referenced, not just once); the first copy is in BaseLayout's own
24
- // `.wd-sidebar-col`, for desktop. Both copies exist in the DOM on every
25
- // load; only one is ever visible at a time (mobile-menu.css hides this
26
- // whole panel above 860px, base.css hides .wd-sidebar-col at/below it),
27
- // so there's no duplicate-content flash either way.
20
+ // The sidebar itself isn't rendered here: `.wd-mobile-menu-sidebar` starts
21
+ // empty, and opening the menu moves the page's one sidebar - the children
22
+ // of BaseLayout's `.wd-sidebar-col`, hidden at this width - into it
23
+ // (src/scripts/mobile-menu.ts); widening the window past 860px moves it
24
+ // back. It used to be a second copy of the `sidebar` slot, and on a site
25
+ // with a long navigation (an OpenAPI section with hundreds of operations)
26
+ // that copy was half of every page's HTML.
28
27
  //
29
28
  // Split out of BaseLayout.astro, which had grown to ~2200 lines covering
30
29
  // several unrelated concerns in one file - see that component's own
@@ -198,11 +197,8 @@ const showMenu = hasMobileMenu({ sidebar: showSidebarCol, selectors, globalDropd
198
197
  )}
199
198
  </div>
200
199
  )}
201
- {showSidebarCol && (
202
- <div class="wd-mobile-menu-sidebar">
203
- <slot name="sidebar" />
204
- </div>
205
- )}
200
+ {/* Filled by initMobileMenu() when the menu opens - see this file's top comment. */}
201
+ {showSidebarCol && <div class="wd-mobile-menu-sidebar"></div>}
206
202
  </div>
207
203
  </div>
208
204
  </div>
@@ -12,6 +12,18 @@ interface Props {
12
12
  }
13
13
 
14
14
  const { nodes, hrefForSlug, currentSlug, depth = 0 } = Astro.props as Props;
15
+
16
+ // The <style> below is global, not scoped: a scoped one puts a
17
+ // data-astro-cid-* attribute on every <li>, <a> and <span> here - four per
18
+ // item, 24 bytes each - and the tree is on every page, in full. With a long
19
+ // OpenAPI section that was 30% of each page's HTML. Every selector in it
20
+ // starts from a wd-nav-* class, which nothing else on a page uses.
21
+ //
22
+ // Without the scope, a selector is (0,1,0) less specific per part, so two
23
+ // rules with a different number of parts can trade places. One pair did:
24
+ // `.wd-nav-list a.active` came to outweigh `.wd-nav-group
25
+ // .wd-nav-section-title a` - hence the font-weight there. A new rule has to be
26
+ // weighed against the others with nothing but its own selectors to count.
15
27
  ---
16
28
 
17
29
  <ul class={`wd-nav-list wd-nav-depth-${depth}`}>
@@ -122,7 +134,7 @@ const { nodes, hrefForSlug, currentSlug, depth = 0 } = Astro.props as Props;
122
134
  }
123
135
  </ul>
124
136
 
125
- <style>
137
+ <style is:global>
126
138
  .wd-nav-list {
127
139
  list-style: none;
128
140
  margin: 0;
@@ -194,6 +206,9 @@ const { nodes, hrefForSlug, currentSlug, depth = 0 } = Astro.props as Props;
194
206
  .wd-nav-group .wd-nav-section-title a:hover {
195
207
  background: none;
196
208
  color: var(--wd-primary);
209
+ /* The title's own weight, not `.wd-nav-list a.active`'s 500 - which
210
+ ties with the rule above on specificity, and comes later. */
211
+ font-weight: inherit;
197
212
  }
198
213
  .wd-nav-depth-1,
199
214
  .wd-nav-depth-2,
@@ -239,15 +254,15 @@ const { nodes, hrefForSlug, currentSlug, depth = 0 } = Astro.props as Props;
239
254
  /* text-overflow: ellipsis;
240
255
  white-space: nowrap; */
241
256
  }
242
- /* A page's own frontmatter `icon` (Mintlify's) - :global() because
243
- AppIcon.astro renders the svg/span, not this component. */
244
- :global(svg.wd-nav-page-icon),
245
- :global(span.wd-nav-page-icon) {
257
+ /* A page's own frontmatter `icon` (Mintlify's), which AppIcon.astro
258
+ renders as an svg or a span. */
259
+ svg.wd-nav-page-icon,
260
+ span.wd-nav-page-icon {
246
261
  flex-shrink: 0;
247
262
  width: 1em;
248
263
  height: 1em;
249
264
  }
250
- :global(span.wd-nav-page-icon) {
265
+ span.wd-nav-page-icon {
251
266
  display: flex;
252
267
  align-items: center;
253
268
  justify-content: center;
@@ -152,7 +152,7 @@ const { navTree, hrefForSlug, currentSlug, switchers = [] } = Astro.props as Pro
152
152
  margin-top: 0.2rem;
153
153
  }
154
154
  /* The mobile menu already lists every level as its own row above the
155
- sidebar - no second copy there. */
155
+ sidebar (once moved in there) - no second switcher there. */
156
156
  :global(#wd-mobile-menu) .wd-sidebar-switcher {
157
157
  display: none;
158
158
  }
@@ -192,8 +192,8 @@ const { navTree, hrefForSlug, currentSlug, switchers = [] } = Astro.props as Pro
192
192
  force it to actually be that tall when content is shorter, which is
193
193
  exactly the "empty space below the watermark" case this replaces.
194
194
  Scoped to .wd-sidebar-col specifically (not the plain .wd-sidebar
195
- this component always renders) so the *reused* copy inside
196
- MobileMenu.astro's own scrollable panel is untouched - forcing a
195
+ this component always renders) so the sidebar is untouched once the
196
+ menu's script moves it into MobileMenu.astro's scrollable panel - forcing a
197
197
  tall fixed height there would leave an awkward blank stretch inside
198
198
  the mobile drawer under a short nav list, where "pinned to the
199
199
  bottom of the screen" isn't really representative of a panel the
@@ -205,7 +205,7 @@ const { navTree, hrefForSlug, currentSlug, switchers = [] } = Astro.props as Pro
205
205
  }
206
206
  /* Last thing in the nav column. margin-top: auto only has real estate
207
207
  to push into on desktop (where the rule above gives .wd-sidebar a
208
- real fixed height) - inside the mobile menu's reused copy, .wd-
208
+ real fixed height) - inside the mobile menu's panel, .wd-
209
209
  sidebar is never a flex container, so this margin resolves to 0 and
210
210
  the watermark just falls in after the last nav item instead, same
211
211
  as before that rule existed. Either way, padding-top + border-top