@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.
- package/astro.config.mjs +32 -8
- package/package.json +3 -1
- package/src/cli/astro-output.js +44 -11
- package/src/cli/base-path-layout.js +44 -0
- package/src/cli/build.js +18 -9
- package/src/cli/check-built-styles.js +41 -33
- package/src/cli/dev.js +21 -4
- 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 +245 -237
- 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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
|
|
34
|
-
const
|
|
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
|
-
{link.
|
|
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
|
-
|
|
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
|
+
)}
|