@writedocs/generator 0.10.19 → 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 (59) hide show
  1. package/astro.config.mjs +32 -8
  2. package/package.json +96 -93
  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/generate-api-pages.js +9 -5
  8. package/src/cli/page-list-watch.js +69 -66
  9. package/src/cli/run-pagefind.js +154 -148
  10. package/src/cli/write-mcp-files.js +103 -96
  11. package/src/cli/write-redirects-file.js +25 -8
  12. package/src/components/AppIcon.astro +51 -50
  13. package/src/components/Card.astro +193 -192
  14. package/src/components/CopyPageMenu.astro +374 -370
  15. package/src/components/Hint.astro +188 -187
  16. package/src/components/Icon.astro +72 -71
  17. package/src/components/Image.astro +165 -164
  18. package/src/components/Tile.astro +67 -66
  19. package/src/components/Video.astro +137 -136
  20. package/src/layout/BaseLayout.astro +21 -12
  21. package/src/layout/components/AnalyticsScripts.astro +6 -2
  22. package/src/layout/components/Breadcrumbs.astro +98 -97
  23. package/src/layout/components/ConsentBanner.astro +119 -118
  24. package/src/layout/components/MobileMenu.astro +229 -228
  25. package/src/layout/components/NavTree.astro +393 -392
  26. package/src/layout/components/Sidebar.astro +232 -231
  27. package/src/layout/components/SiteFooter.astro +87 -86
  28. package/src/layout/components/TopBar.astro +386 -385
  29. package/src/lib/agent-markdown.js +164 -162
  30. package/src/lib/asset-dimensions.js +89 -0
  31. package/src/lib/base-path.js +90 -0
  32. package/src/lib/config-schema.js +10 -0
  33. package/src/lib/config-schema.ts +17 -0
  34. package/src/lib/config.ts +1314 -1289
  35. package/src/lib/consent.js +108 -102
  36. package/src/lib/image-size.js +152 -140
  37. package/src/lib/json-schema-descriptions.js +1 -0
  38. package/src/lib/link-check.js +42 -4
  39. package/src/lib/llms-index.ts +90 -88
  40. package/src/lib/mcp-dev-integration.js +65 -60
  41. package/src/lib/mcp-index.ts +102 -101
  42. package/src/lib/pages.js +312 -304
  43. package/src/lib/project-files-integration.js +116 -61
  44. package/src/lib/project-files.js +137 -126
  45. package/src/lib/project-ignore.js +46 -0
  46. package/src/lib/rehype-base-path.js +62 -0
  47. package/src/lib/rehype-image-loading.js +71 -71
  48. package/src/lib/robots-txt.js +21 -16
  49. package/src/lib/seo-tags.js +155 -140
  50. package/src/lib/site-base.ts +27 -0
  51. package/src/lib/styles-asset-integration.js +58 -12
  52. package/src/lib/wdignore-cases.json +195 -0
  53. package/src/lib/wdignore.js +177 -0
  54. package/src/pages/404.astro +63 -62
  55. package/src/pages/[...slug].astro +1604 -1597
  56. package/src/pages/[...slug].md.ts +93 -93
  57. package/src/pages/llms-full.txt.ts +88 -86
  58. package/src/scripts/search.ts +241 -237
  59. package/writedocs.schema.json +6 -0
@@ -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>