@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.
- package/astro.config.mjs +32 -8
- package/package.json +1 -1
- package/src/cli/base-path-layout.js +44 -0
- package/src/cli/build.js +177 -168
- package/src/cli/check-built-styles.js +41 -33
- package/src/cli/dev.js +261 -244
- package/src/cli/run-pagefind.js +154 -148
- package/src/cli/write-mcp-files.js +103 -96
- package/src/cli/write-redirects-file.js +25 -8
- package/src/components/AppIcon.astro +51 -50
- package/src/components/Card.astro +193 -192
- package/src/components/CopyPageMenu.astro +374 -370
- package/src/components/Hint.astro +188 -187
- package/src/components/Icon.astro +72 -71
- package/src/components/Image.astro +3 -2
- package/src/components/Tile.astro +67 -66
- package/src/components/Video.astro +137 -136
- package/src/layout/BaseLayout.astro +21 -12
- package/src/layout/components/AnalyticsScripts.astro +6 -2
- package/src/layout/components/Breadcrumbs.astro +98 -97
- package/src/layout/components/ConsentBanner.astro +119 -118
- package/src/layout/components/MobileMenu.astro +229 -228
- package/src/layout/components/NavTree.astro +393 -392
- package/src/layout/components/Sidebar.astro +232 -231
- package/src/layout/components/SiteFooter.astro +87 -86
- package/src/layout/components/TopBar.astro +386 -385
- package/src/lib/agent-markdown.js +164 -162
- package/src/lib/asset-dimensions.js +89 -89
- package/src/lib/base-path.js +90 -0
- package/src/lib/config-schema.js +10 -0
- package/src/lib/config-schema.ts +17 -0
- package/src/lib/config.ts +1314 -1289
- package/src/lib/consent.js +108 -102
- package/src/lib/json-schema-descriptions.js +1 -0
- package/src/lib/link-check.js +7 -2
- package/src/lib/llms-index.ts +90 -88
- package/src/lib/mcp-dev-integration.js +65 -60
- package/src/lib/mcp-index.ts +102 -101
- package/src/lib/project-files-integration.js +2 -2
- package/src/lib/rehype-base-path.js +62 -0
- package/src/lib/robots-txt.js +21 -16
- package/src/lib/seo-tags.js +155 -140
- package/src/lib/site-base.ts +27 -0
- package/src/lib/styles-asset-integration.js +23 -10
- package/src/lib/wdignore-cases.json +195 -195
- package/src/lib/wdignore.js +177 -177
- package/src/pages/404.astro +63 -62
- package/src/pages/[...slug].astro +1604 -1597
- package/src/pages/[...slug].md.ts +93 -93
- package/src/pages/llms-full.txt.ts +88 -86
- package/src/scripts/search.ts +241 -237
- 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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
{
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
</
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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
|
-
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
{consent.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
<button type="button" class="wd-consent-button
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
</
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
font
|
|
88
|
-
font-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
border:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
color: var(--wd-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
outline
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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>
|