@writedocs/generator 0.10.20 → 0.11.1

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 (53) hide show
  1. package/astro.config.mjs +32 -8
  2. package/package.json +3 -1
  3. package/src/cli/astro-output.js +44 -11
  4. package/src/cli/base-path-layout.js +44 -0
  5. package/src/cli/build.js +18 -9
  6. package/src/cli/check-built-styles.js +41 -33
  7. package/src/cli/dev.js +21 -4
  8. package/src/cli/run-pagefind.js +154 -148
  9. package/src/cli/write-mcp-files.js +103 -96
  10. package/src/cli/write-redirects-file.js +25 -8
  11. package/src/components/AppIcon.astro +51 -50
  12. package/src/components/Card.astro +193 -192
  13. package/src/components/CopyPageMenu.astro +374 -370
  14. package/src/components/Hint.astro +188 -187
  15. package/src/components/Icon.astro +72 -71
  16. package/src/components/Image.astro +3 -2
  17. package/src/components/Tile.astro +67 -66
  18. package/src/components/Video.astro +137 -136
  19. package/src/layout/BaseLayout.astro +21 -12
  20. package/src/layout/components/AnalyticsScripts.astro +6 -2
  21. package/src/layout/components/Breadcrumbs.astro +98 -97
  22. package/src/layout/components/ConsentBanner.astro +119 -118
  23. package/src/layout/components/MobileMenu.astro +229 -228
  24. package/src/layout/components/NavTree.astro +393 -392
  25. package/src/layout/components/Sidebar.astro +232 -231
  26. package/src/layout/components/SiteFooter.astro +87 -86
  27. package/src/layout/components/TopBar.astro +386 -385
  28. package/src/lib/agent-markdown.js +164 -162
  29. package/src/lib/asset-dimensions.js +89 -89
  30. package/src/lib/base-path.js +90 -0
  31. package/src/lib/config-schema.js +10 -0
  32. package/src/lib/config-schema.ts +17 -0
  33. package/src/lib/config.ts +1314 -1289
  34. package/src/lib/consent.js +108 -102
  35. package/src/lib/json-schema-descriptions.js +1 -0
  36. package/src/lib/link-check.js +7 -2
  37. package/src/lib/llms-index.ts +90 -88
  38. package/src/lib/mcp-dev-integration.js +65 -60
  39. package/src/lib/mcp-index.ts +102 -101
  40. package/src/lib/project-files-integration.js +2 -2
  41. package/src/lib/rehype-base-path.js +62 -0
  42. package/src/lib/robots-txt.js +21 -16
  43. package/src/lib/seo-tags.js +155 -140
  44. package/src/lib/site-base.ts +27 -0
  45. package/src/lib/styles-asset-integration.js +23 -10
  46. package/src/lib/wdignore-cases.json +195 -195
  47. package/src/lib/wdignore.js +177 -177
  48. package/src/pages/404.astro +63 -62
  49. package/src/pages/[...slug].astro +1604 -1597
  50. package/src/pages/[...slug].md.ts +93 -93
  51. package/src/pages/llms-full.txt.ts +88 -86
  52. package/src/scripts/search.ts +245 -237
  53. package/writedocs.schema.json +6 -0
@@ -1,97 +1,98 @@
1
- ---
2
- // The ancestor-group trail above the auto-rendered <h1> ("Learn the
3
- // Basics > Authentication Flows") - `items` is ancestorGroupsForSlug()'s
4
- // output (lib/config.ts): the chain of group labels (root first) the
5
- // current page is nested under within its active Section's sidebar tree,
6
- // each linking to that group's own attached page when it has one
7
- // (`href`), or rendered as plain unlinked text when it doesn't.
8
- // Deliberately does NOT include the current page itself as a trailing
9
- // crumb - that's already the <h1> right below this, and repeating it
10
- // here would just be noise. [...slug].astro only renders this component
11
- // at all when `items` is non-empty (a page with no enclosing group has
12
- // no ancestor trail to show, and a home-icon-only bar isn't worth
13
- // rendering on its own).
14
- //
15
- // The home icon is always the first crumb, on every page this component
16
- // renders on, regardless of `items` - a fixed entry point back to `/`,
17
- // not itself part of the ancestor chain. Rendered via astro-icon (same
18
- // system every other writedocs.json `icon` field/AppIcon.astro uses - a real
19
- // build-time <svg>, no client JS/React needed) - fa6-solid:house is the
20
- // Iconify id for the exact same Font Awesome 6 glyph as react-icons'
21
- // `FaHouse`, without pulling React into an otherwise-static nav element.
22
- import { Icon } from 'astro-icon/components';
23
-
24
- export interface BreadcrumbItem {
25
- label: string;
26
- href: string | null;
27
- }
28
-
29
- interface Props {
30
- items: BreadcrumbItem[];
31
- }
32
-
33
- const { items } = Astro.props as Props;
34
- ---
35
- <nav class="wd-breadcrumbs" aria-label="Breadcrumb" data-pagefind-ignore data-markdown-ignore>
36
- <ol class="wd-breadcrumb-list">
37
- <li class="wd-breadcrumb-item">
38
- <a href="/" class="wd-breadcrumb-home" aria-label="Home">
39
- <Icon name="fa6-solid:house" class="wd-breadcrumb-home-icon" />
40
- </a>
41
- <svg class="wd-breadcrumb-sep" width="10" height="10" viewBox="0 0 18 18" fill="none" aria-hidden="true">
42
- <path d="M6.5 2.75L12.75 9L6.5 15.25" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
43
- </svg>
44
- </li>
45
- {items.map((item, i) => (
46
- <li class="wd-breadcrumb-item">
47
- {item.href ? <a href={item.href}>{item.label}</a> : <span>{item.label}</span>}
48
- {i < items.length - 1 && (
49
- <svg class="wd-breadcrumb-sep" width="10" height="10" viewBox="0 0 18 18" fill="none" aria-hidden="true">
50
- <path d="M6.5 2.75L12.75 9L6.5 15.25" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
51
- </svg>
52
- )}
53
- </li>
54
- ))}
55
- </ol>
56
- </nav>
57
-
58
- <style>
59
- .wd-breadcrumbs {
60
- margin-bottom: 0.6rem;
61
- }
62
- .wd-breadcrumb-list {
63
- display: flex;
64
- flex-wrap: wrap;
65
- align-items: center;
66
- gap: 0.35rem;
67
- list-style: none;
68
- margin: 0;
69
- padding: 0;
70
- font-size: 0.85rem;
71
- color: var(--wd-text-muted);
72
- }
73
- .wd-breadcrumb-item {
74
- display: flex;
75
- align-items: center;
76
- gap: 0.35rem;
77
- }
78
- .wd-breadcrumb-item a {
79
- display: flex;
80
- align-items: center;
81
- color: inherit;
82
- text-decoration: none;
83
- }
84
- .wd-breadcrumb-item a:hover {
85
- color: var(--wd-text);
86
- }
87
- .wd-breadcrumb-home-icon {
88
- width: 0.85em;
89
- height: 0.85em;
90
- flex-shrink: 0;
91
- }
92
- .wd-breadcrumb-sep {
93
- flex-shrink: 0;
94
- color: var(--wd-text-muted);
95
- opacity: 0.6;
96
- }
97
- </style>
1
+ ---
2
+ // The ancestor-group trail above the auto-rendered <h1> ("Learn the
3
+ // Basics > Authentication Flows") - `items` is ancestorGroupsForSlug()'s
4
+ // output (lib/config.ts): the chain of group labels (root first) the
5
+ // current page is nested under within its active Section's sidebar tree,
6
+ // each linking to that group's own attached page when it has one
7
+ // (`href`), or rendered as plain unlinked text when it doesn't.
8
+ // Deliberately does NOT include the current page itself as a trailing
9
+ // crumb - that's already the <h1> right below this, and repeating it
10
+ // here would just be noise. [...slug].astro only renders this component
11
+ // at all when `items` is non-empty (a page with no enclosing group has
12
+ // no ancestor trail to show, and a home-icon-only bar isn't worth
13
+ // rendering on its own).
14
+ //
15
+ // The home icon is always the first crumb, on every page this component
16
+ // renders on, regardless of `items` - a fixed entry point back to `/`,
17
+ // not itself part of the ancestor chain. Rendered via astro-icon (same
18
+ // system every other writedocs.json `icon` field/AppIcon.astro uses - a real
19
+ // build-time <svg>, no client JS/React needed) - fa6-solid:house is the
20
+ // Iconify id for the exact same Font Awesome 6 glyph as react-icons'
21
+ // `FaHouse`, without pulling React into an otherwise-static nav element.
22
+ import { Icon } from 'astro-icon/components';
23
+ import { siteHref } from '../../lib/site-base';
24
+
25
+ export interface BreadcrumbItem {
26
+ label: string;
27
+ href: string | null;
28
+ }
29
+
30
+ interface Props {
31
+ items: BreadcrumbItem[];
32
+ }
33
+
34
+ const { items } = Astro.props as Props;
35
+ ---
36
+ <nav class="wd-breadcrumbs" aria-label="Breadcrumb" data-pagefind-ignore data-markdown-ignore>
37
+ <ol class="wd-breadcrumb-list">
38
+ <li class="wd-breadcrumb-item">
39
+ <a href={siteHref("/")} class="wd-breadcrumb-home" aria-label="Home">
40
+ <Icon name="fa6-solid:house" class="wd-breadcrumb-home-icon" />
41
+ </a>
42
+ <svg class="wd-breadcrumb-sep" width="10" height="10" viewBox="0 0 18 18" fill="none" aria-hidden="true">
43
+ <path d="M6.5 2.75L12.75 9L6.5 15.25" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
44
+ </svg>
45
+ </li>
46
+ {items.map((item, i) => (
47
+ <li class="wd-breadcrumb-item">
48
+ {item.href ? <a href={siteHref(item.href)}>{item.label}</a> : <span>{item.label}</span>}
49
+ {i < items.length - 1 && (
50
+ <svg class="wd-breadcrumb-sep" width="10" height="10" viewBox="0 0 18 18" fill="none" aria-hidden="true">
51
+ <path d="M6.5 2.75L12.75 9L6.5 15.25" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
52
+ </svg>
53
+ )}
54
+ </li>
55
+ ))}
56
+ </ol>
57
+ </nav>
58
+
59
+ <style>
60
+ .wd-breadcrumbs {
61
+ margin-bottom: 0.6rem;
62
+ }
63
+ .wd-breadcrumb-list {
64
+ display: flex;
65
+ flex-wrap: wrap;
66
+ align-items: center;
67
+ gap: 0.35rem;
68
+ list-style: none;
69
+ margin: 0;
70
+ padding: 0;
71
+ font-size: 0.85rem;
72
+ color: var(--wd-text-muted);
73
+ }
74
+ .wd-breadcrumb-item {
75
+ display: flex;
76
+ align-items: center;
77
+ gap: 0.35rem;
78
+ }
79
+ .wd-breadcrumb-item a {
80
+ display: flex;
81
+ align-items: center;
82
+ color: inherit;
83
+ text-decoration: none;
84
+ }
85
+ .wd-breadcrumb-item a:hover {
86
+ color: var(--wd-text);
87
+ }
88
+ .wd-breadcrumb-home-icon {
89
+ width: 0.85em;
90
+ height: 0.85em;
91
+ flex-shrink: 0;
92
+ }
93
+ .wd-breadcrumb-sep {
94
+ flex-shrink: 0;
95
+ color: var(--wd-text-muted);
96
+ opacity: 0.6;
97
+ }
98
+ </style>
@@ -1,118 +1,119 @@
1
- ---
2
- // writedocs.json's `integrations.consent` - the banner that asks before the
3
- // analytics integrations load. It's in the page hidden; src/scripts/
4
- // consent.ts shows it when the reader hasn't answered yet (window.wdConsent,
5
- // defined in <head> by consentLoaderScript() in lib/consent.js), and again
6
- // when they follow a link to #cookie-settings.
7
- //
8
- // A strip along the bottom of the window rather than a dialog: the page
9
- // stays readable and usable while it's there, so focus isn't trapped and
10
- // nothing is covered that can't be scrolled into view (consent.ts pads the
11
- // page's end by the banner's height).
12
- interface Props {
13
- consent: {
14
- message: string;
15
- acceptLabel: string;
16
- declineLabel: string;
17
- policyUrl: string | null;
18
- policyLabel: string;
19
- };
20
- }
21
- const { consent } = Astro.props as Props;
22
- ---
23
- <section class="wd-consent" id="wd-consent" aria-label="Cookie consent" data-pagefind-ignore hidden>
24
- <div class="wd-consent-inner">
25
- <p class="wd-consent-text">
26
- {consent.message}{" "}
27
- {consent.policyUrl && <a href={consent.policyUrl}>{consent.policyLabel}</a>}
28
- </p>
29
- <div class="wd-consent-actions">
30
- <button type="button" class="wd-consent-button" data-consent="denied">{consent.declineLabel}</button>
31
- <button type="button" class="wd-consent-button wd-consent-accept" data-consent="granted">{consent.acceptLabel}</button>
32
- </div>
33
- </div>
34
- </section>
35
-
36
- <script>
37
- import { initConsent } from "../../scripts/consent";
38
-
39
- initConsent(document);
40
- document.addEventListener("astro:page-load", () => initConsent(document));
41
- </script>
42
-
43
- <style is:global>
44
- .wd-consent {
45
- position: fixed;
46
- left: 0;
47
- right: 0;
48
- bottom: 0;
49
- /* Above the topbar (10) and the page; below the search and image
50
- overlays (100), which the reader opened on purpose. */
51
- z-index: 50;
52
- background: var(--wd-surface);
53
- border-top: 1px solid var(--wd-border);
54
- color: var(--wd-text);
55
- box-shadow: 0 -4px 16px rgb(0 0 0 / 0.08);
56
- }
57
- .wd-consent[hidden] {
58
- display: none;
59
- }
60
- .wd-consent-inner {
61
- max-width: 1440px;
62
- margin: 0 auto;
63
- padding: 0.85rem 1.5rem;
64
- display: flex;
65
- align-items: center;
66
- justify-content: space-between;
67
- gap: 1rem 1.5rem;
68
- }
69
- .wd-consent-text {
70
- margin: 0;
71
- font-size: 0.88rem;
72
- line-height: 1.5;
73
- }
74
- .wd-consent-text a {
75
- color: var(--wd-primary);
76
- text-decoration: underline;
77
- }
78
- .wd-consent-actions {
79
- display: flex;
80
- gap: 0.5rem;
81
- flex-shrink: 0;
82
- }
83
- /* Both buttons the same size and weight but for the fill - declining is as
84
- easy as accepting. */
85
- .wd-consent-button {
86
- font: inherit;
87
- font-size: 0.85rem;
88
- font-weight: 600;
89
- padding: 0.45rem 1rem;
90
- border-radius: 0.5rem;
91
- border: 1px solid var(--wd-border);
92
- background: var(--wd-background);
93
- color: var(--wd-heading);
94
- cursor: pointer;
95
- }
96
- .wd-consent-button:hover {
97
- border-color: var(--wd-primary);
98
- }
99
- .wd-consent-accept {
100
- background: var(--wd-primary);
101
- border-color: var(--wd-primary);
102
- color: var(--wd-on-primary);
103
- }
104
- .wd-consent-button:focus-visible {
105
- outline: 2px solid var(--wd-primary);
106
- outline-offset: 2px;
107
- }
108
- @media (max-width: 640px) {
109
- .wd-consent-inner {
110
- flex-direction: column;
111
- align-items: stretch;
112
- padding: 0.85rem 1rem;
113
- }
114
- .wd-consent-actions > .wd-consent-button {
115
- flex: 1;
116
- }
117
- }
118
- </style>
1
+ ---
2
+ import { siteHref } from '../../lib/site-base';
3
+ // writedocs.json's `integrations.consent` - the banner that asks before the
4
+ // analytics integrations load. It's in the page hidden; src/scripts/
5
+ // consent.ts shows it when the reader hasn't answered yet (window.wdConsent,
6
+ // defined in <head> by consentLoaderScript() in lib/consent.js), and again
7
+ // when they follow a link to #cookie-settings.
8
+ //
9
+ // A strip along the bottom of the window rather than a dialog: the page
10
+ // stays readable and usable while it's there, so focus isn't trapped and
11
+ // nothing is covered that can't be scrolled into view (consent.ts pads the
12
+ // page's end by the banner's height).
13
+ interface Props {
14
+ consent: {
15
+ message: string;
16
+ acceptLabel: string;
17
+ declineLabel: string;
18
+ policyUrl: string | null;
19
+ policyLabel: string;
20
+ };
21
+ }
22
+ const { consent } = Astro.props as Props;
23
+ ---
24
+ <section class="wd-consent" id="wd-consent" aria-label="Cookie consent" data-pagefind-ignore hidden>
25
+ <div class="wd-consent-inner">
26
+ <p class="wd-consent-text">
27
+ {consent.message}{" "}
28
+ {consent.policyUrl && <a href={siteHref(consent.policyUrl)}>{consent.policyLabel}</a>}
29
+ </p>
30
+ <div class="wd-consent-actions">
31
+ <button type="button" class="wd-consent-button" data-consent="denied">{consent.declineLabel}</button>
32
+ <button type="button" class="wd-consent-button wd-consent-accept" data-consent="granted">{consent.acceptLabel}</button>
33
+ </div>
34
+ </div>
35
+ </section>
36
+
37
+ <script>
38
+ import { initConsent } from "../../scripts/consent";
39
+
40
+ initConsent(document);
41
+ document.addEventListener("astro:page-load", () => initConsent(document));
42
+ </script>
43
+
44
+ <style is:global>
45
+ .wd-consent {
46
+ position: fixed;
47
+ left: 0;
48
+ right: 0;
49
+ bottom: 0;
50
+ /* Above the topbar (10) and the page; below the search and image
51
+ overlays (100), which the reader opened on purpose. */
52
+ z-index: 50;
53
+ background: var(--wd-surface);
54
+ border-top: 1px solid var(--wd-border);
55
+ color: var(--wd-text);
56
+ box-shadow: 0 -4px 16px rgb(0 0 0 / 0.08);
57
+ }
58
+ .wd-consent[hidden] {
59
+ display: none;
60
+ }
61
+ .wd-consent-inner {
62
+ max-width: 1440px;
63
+ margin: 0 auto;
64
+ padding: 0.85rem 1.5rem;
65
+ display: flex;
66
+ align-items: center;
67
+ justify-content: space-between;
68
+ gap: 1rem 1.5rem;
69
+ }
70
+ .wd-consent-text {
71
+ margin: 0;
72
+ font-size: 0.88rem;
73
+ line-height: 1.5;
74
+ }
75
+ .wd-consent-text a {
76
+ color: var(--wd-primary);
77
+ text-decoration: underline;
78
+ }
79
+ .wd-consent-actions {
80
+ display: flex;
81
+ gap: 0.5rem;
82
+ flex-shrink: 0;
83
+ }
84
+ /* Both buttons the same size and weight but for the fill - declining is as
85
+ easy as accepting. */
86
+ .wd-consent-button {
87
+ font: inherit;
88
+ font-size: 0.85rem;
89
+ font-weight: 600;
90
+ padding: 0.45rem 1rem;
91
+ border-radius: 0.5rem;
92
+ border: 1px solid var(--wd-border);
93
+ background: var(--wd-background);
94
+ color: var(--wd-heading);
95
+ cursor: pointer;
96
+ }
97
+ .wd-consent-button:hover {
98
+ border-color: var(--wd-primary);
99
+ }
100
+ .wd-consent-accept {
101
+ background: var(--wd-primary);
102
+ border-color: var(--wd-primary);
103
+ color: var(--wd-on-primary);
104
+ }
105
+ .wd-consent-button:focus-visible {
106
+ outline: 2px solid var(--wd-primary);
107
+ outline-offset: 2px;
108
+ }
109
+ @media (max-width: 640px) {
110
+ .wd-consent-inner {
111
+ flex-direction: column;
112
+ align-items: stretch;
113
+ padding: 0.85rem 1rem;
114
+ }
115
+ .wd-consent-actions > .wd-consent-button {
116
+ flex: 1;
117
+ }
118
+ }
119
+ </style>