@writedocs/generator 0.10.20 → 0.11.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 (52) hide show
  1. package/astro.config.mjs +32 -8
  2. package/package.json +1 -1
  3. package/src/cli/base-path-layout.js +44 -0
  4. package/src/cli/build.js +177 -168
  5. package/src/cli/check-built-styles.js +41 -33
  6. package/src/cli/dev.js +261 -244
  7. package/src/cli/run-pagefind.js +154 -148
  8. package/src/cli/write-mcp-files.js +103 -96
  9. package/src/cli/write-redirects-file.js +25 -8
  10. package/src/components/AppIcon.astro +51 -50
  11. package/src/components/Card.astro +193 -192
  12. package/src/components/CopyPageMenu.astro +374 -370
  13. package/src/components/Hint.astro +188 -187
  14. package/src/components/Icon.astro +72 -71
  15. package/src/components/Image.astro +3 -2
  16. package/src/components/Tile.astro +67 -66
  17. package/src/components/Video.astro +137 -136
  18. package/src/layout/BaseLayout.astro +21 -12
  19. package/src/layout/components/AnalyticsScripts.astro +6 -2
  20. package/src/layout/components/Breadcrumbs.astro +98 -97
  21. package/src/layout/components/ConsentBanner.astro +119 -118
  22. package/src/layout/components/MobileMenu.astro +229 -228
  23. package/src/layout/components/NavTree.astro +393 -392
  24. package/src/layout/components/Sidebar.astro +232 -231
  25. package/src/layout/components/SiteFooter.astro +87 -86
  26. package/src/layout/components/TopBar.astro +386 -385
  27. package/src/lib/agent-markdown.js +164 -162
  28. package/src/lib/asset-dimensions.js +89 -89
  29. package/src/lib/base-path.js +90 -0
  30. package/src/lib/config-schema.js +10 -0
  31. package/src/lib/config-schema.ts +17 -0
  32. package/src/lib/config.ts +1314 -1289
  33. package/src/lib/consent.js +108 -102
  34. package/src/lib/json-schema-descriptions.js +1 -0
  35. package/src/lib/link-check.js +7 -2
  36. package/src/lib/llms-index.ts +90 -88
  37. package/src/lib/mcp-dev-integration.js +65 -60
  38. package/src/lib/mcp-index.ts +102 -101
  39. package/src/lib/project-files-integration.js +2 -2
  40. package/src/lib/rehype-base-path.js +62 -0
  41. package/src/lib/robots-txt.js +21 -16
  42. package/src/lib/seo-tags.js +155 -140
  43. package/src/lib/site-base.ts +27 -0
  44. package/src/lib/styles-asset-integration.js +23 -10
  45. package/src/lib/wdignore-cases.json +195 -195
  46. package/src/lib/wdignore.js +177 -177
  47. package/src/pages/404.astro +63 -62
  48. package/src/pages/[...slug].astro +1604 -1597
  49. package/src/pages/[...slug].md.ts +93 -93
  50. package/src/pages/llms-full.txt.ts +88 -86
  51. package/src/scripts/search.ts +241 -237
  52. package/writedocs.schema.json +6 -0
@@ -1,86 +1,87 @@
1
- ---
2
- // writedocs.json's `footer.columns`/`socials` - see footerSchema/`socials` in
3
- // lib/config.ts. Renders nothing at all (not even an empty bordered band)
4
- // when a site hasn't configured either - both fields default to empty, so
5
- // `hasFooterContent` is never undefined either way. Callers don't need to
6
- // check this themselves; this component decides on its own whether it has
7
- // anything to show.
8
- //
9
- // Split out of BaseLayout.astro, which had grown to ~2200 lines covering
10
- // several unrelated concerns in one file - see that component's own
11
- // comment for the fuller rationale.
12
- import { isExternalHref, type DocsConfig } from '../../lib/config';
13
- import AppIcon from '../../components/AppIcon.astro';
14
- import { logoWidth } from '../../lib/image-size.js';
15
- import '../styles/footer.css';
16
-
17
- interface Props {
18
- config: DocsConfig;
19
- logoLight?: string;
20
- logoDark?: string;
21
- }
22
- const { config, logoLight, logoDark } = Astro.props as Props;
23
- const hasLogoImage = Boolean(logoLight || logoDark);
24
- const socialEntries = Object.entries(config.socials);
25
- // A `socials` key doubles as its own icon reference (resolveIcon() in
26
- // lib/config.ts, via <AppIcon>) - fine as-is for a bare name like
27
- // "github", but a key using the explicit "collection:icon-name" form
28
- // (e.g. "simple-icons:discord", for a platform Lucide doesn't have a
29
- // matching icon for) would otherwise end up as this link's own aria-label
30
- // verbatim, colon and all - not what a screen reader user wants read
31
- // aloud. Strips down to just the part after the last colon for the label
32
- // specifically; the full key still goes to AppIcon unchanged.
33
- const socialLabel = (platform: string) => platform.split(':').pop() ?? platform;
34
- const hasFooterContent = config.footer.columns.length > 0 || socialEntries.length > 0;
35
- ---
36
- {hasFooterContent && (
37
- <footer class="wd-footer">
38
- <div class="wd-footer-inner">
39
- {hasLogoImage && (
40
- <a class="wd-footer-brand" href="/">
41
- {logoLight && <img src={logoLight} alt={config.name} height="24" width={logoWidth(logoLight)} class="wd-logo-light" />}
42
- {logoDark && <img src={logoDark} alt={config.name} height="24" width={logoWidth(logoDark)} class="wd-logo-dark" />}
43
- </a>
44
- )}
45
- {config.footer.columns.length > 0 && (
46
- <div class="wd-footer-columns">
47
- {config.footer.columns.map((column) => (
48
- <div class="wd-footer-column">
49
- {column.title && <div class="wd-footer-column-title">{column.title}</div>}
50
- <ul class="wd-footer-column-links">
51
- {column.links.map((link) => (
52
- <li>
53
- <a
54
- href={link.href}
55
- target={isExternalHref(link.href) ? '_blank' : undefined}
56
- rel={isExternalHref(link.href) ? 'noopener noreferrer' : undefined}
57
- aria-label={!link.label ? link.icon : undefined}
58
- >
59
- <AppIcon icon={link.icon} class="wd-tab-icon" />
60
- {link.label}
61
- </a>
62
- </li>
63
- ))}
64
- </ul>
65
- </div>
66
- ))}
67
- </div>
68
- )}
69
- {socialEntries.length > 0 && (
70
- <div class="wd-footer-socials">
71
- {socialEntries.map(([platform, url]) => (
72
- <a
73
- href={url}
74
- class="wd-footer-social-link"
75
- aria-label={socialLabel(platform)}
76
- target={isExternalHref(url) ? '_blank' : undefined}
77
- rel={isExternalHref(url) ? 'noopener noreferrer' : undefined}
78
- >
79
- <AppIcon icon={platform} class="wd-footer-social-icon" />
80
- </a>
81
- ))}
82
- </div>
83
- )}
84
- </div>
85
- </footer>
86
- )}
1
+ ---
2
+ // writedocs.json's `footer.columns`/`socials` - see footerSchema/`socials` in
3
+ // lib/config.ts. Renders nothing at all (not even an empty bordered band)
4
+ // when a site hasn't configured either - both fields default to empty, so
5
+ // `hasFooterContent` is never undefined either way. Callers don't need to
6
+ // check this themselves; this component decides on its own whether it has
7
+ // anything to show.
8
+ //
9
+ // Split out of BaseLayout.astro, which had grown to ~2200 lines covering
10
+ // several unrelated concerns in one file - see that component's own
11
+ // comment for the fuller rationale.
12
+ import { isExternalHref, type DocsConfig } from '../../lib/config';
13
+ import AppIcon from '../../components/AppIcon.astro';
14
+ import { logoWidth } from '../../lib/image-size.js';
15
+ import '../styles/footer.css';
16
+ import { siteHref } from '../../lib/site-base';
17
+
18
+ interface Props {
19
+ config: DocsConfig;
20
+ logoLight?: string;
21
+ logoDark?: string;
22
+ }
23
+ const { config, logoLight, logoDark } = Astro.props as Props;
24
+ const hasLogoImage = Boolean(logoLight || logoDark);
25
+ const socialEntries = Object.entries(config.socials);
26
+ // A `socials` key doubles as its own icon reference (resolveIcon() in
27
+ // lib/config.ts, via <AppIcon>) - fine as-is for a bare name like
28
+ // "github", but a key using the explicit "collection:icon-name" form
29
+ // (e.g. "simple-icons:discord", for a platform Lucide doesn't have a
30
+ // matching icon for) would otherwise end up as this link's own aria-label
31
+ // verbatim, colon and all - not what a screen reader user wants read
32
+ // aloud. Strips down to just the part after the last colon for the label
33
+ // specifically; the full key still goes to AppIcon unchanged.
34
+ const socialLabel = (platform: string) => platform.split(':').pop() ?? platform;
35
+ const hasFooterContent = config.footer.columns.length > 0 || socialEntries.length > 0;
36
+ ---
37
+ {hasFooterContent && (
38
+ <footer class="wd-footer">
39
+ <div class="wd-footer-inner">
40
+ {hasLogoImage && (
41
+ <a class="wd-footer-brand" href={siteHref("/")}>
42
+ {logoLight && <img src={siteHref(logoLight)} alt={config.name} height="24" width={logoWidth(logoLight)} class="wd-logo-light" />}
43
+ {logoDark && <img src={siteHref(logoDark)} alt={config.name} height="24" width={logoWidth(logoDark)} class="wd-logo-dark" />}
44
+ </a>
45
+ )}
46
+ {config.footer.columns.length > 0 && (
47
+ <div class="wd-footer-columns">
48
+ {config.footer.columns.map((column) => (
49
+ <div class="wd-footer-column">
50
+ {column.title && <div class="wd-footer-column-title">{column.title}</div>}
51
+ <ul class="wd-footer-column-links">
52
+ {column.links.map((link) => (
53
+ <li>
54
+ <a
55
+ href={siteHref(link.href)}
56
+ target={isExternalHref(link.href) ? '_blank' : undefined}
57
+ rel={isExternalHref(link.href) ? 'noopener noreferrer' : undefined}
58
+ aria-label={!link.label ? link.icon : undefined}
59
+ >
60
+ <AppIcon icon={link.icon} class="wd-tab-icon" />
61
+ {link.label}
62
+ </a>
63
+ </li>
64
+ ))}
65
+ </ul>
66
+ </div>
67
+ ))}
68
+ </div>
69
+ )}
70
+ {socialEntries.length > 0 && (
71
+ <div class="wd-footer-socials">
72
+ {socialEntries.map(([platform, url]) => (
73
+ <a
74
+ href={siteHref(url)}
75
+ class="wd-footer-social-link"
76
+ aria-label={socialLabel(platform)}
77
+ target={isExternalHref(url) ? '_blank' : undefined}
78
+ rel={isExternalHref(url) ? 'noopener noreferrer' : undefined}
79
+ >
80
+ <AppIcon icon={platform} class="wd-footer-social-icon" />
81
+ </a>
82
+ ))}
83
+ </div>
84
+ )}
85
+ </div>
86
+ </footer>
87
+ )}