igniteui-astro-components 0.0.27 → 0.0.29
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/README.md +82 -74
- package/package.json +16 -2
- package/src/assets/images/anatomy-test.png +0 -0
- package/src/components/CopyCode/CopyCode.astro +21 -7
- package/src/components/DocsBreadcrumb/DocsBreadcrumb.astro +33 -21
- package/src/components/DocsBreadcrumb/DocsBreadcrumb.scss +44 -43
- package/src/components/DocsBreadcrumb/README.md +10 -14
- package/src/components/DocsSidebar/DocsSidebar.astro +47 -45
- package/src/components/DocsSidebar/DocsSidebar.scss +120 -122
- package/src/components/DocsSidebar/README.md +25 -21
- package/src/components/DocsSidebar/SidebarFilterInput.astro +24 -29
- package/src/components/DocsSidebar/SidebarFilterInput.scss +90 -89
- package/src/components/DocsSidebar/SidebarLabel.astro +35 -26
- package/src/components/DocsSidebar/sidebar-filter.ts +93 -56
- package/src/components/DocsSubHeader/DocsSubHeader.astro +256 -195
- package/src/components/DocsSubHeader/DocsSubHeader.scss +181 -178
- package/src/components/DocsSubHeader/README.md +18 -16
- package/src/components/DocsToc/DocsToc.astro +301 -280
- package/src/components/DocsToc/DocsToc.scss +20 -21
- package/src/components/DocsToc/README.md +11 -9
- package/src/components/DocsToc/toTreeNodes.ts +3 -8
- package/src/components/DocsTree/DocsTree.astro +32 -20
- package/src/components/DocsTree/DocsTreeItem.astro +35 -30
- package/src/components/DocsTree/README.md +16 -15
- package/src/components/DocsTree/docs-tree.scss +267 -268
- package/src/components/GlobalFooter/GlobalFooter.astro +10 -10
- package/src/components/GlobalFooter/README.md +3 -2
- package/src/components/GlobalNavBar/GlobalNavBar.astro +4 -2
- package/src/components/GlobalNavBar/GlobalNavBar.module.scss +222 -222
- package/src/components/GlobalNavBar/README.md +3 -2
- package/src/components/LicenseIndicator/LicenseIndicator.astro +7 -5
- package/src/components/LicenseIndicator/LicenseIndicator.scss +3 -3
- package/src/components/MobileSidebarToggle/MobileSidebarToggle.astro +16 -17
- package/src/components/MobileSidebarToggle/README.md +3 -2
- package/src/components/MobileTocToggle/MobileTocToggle.astro +75 -61
- package/src/components/MobileTocToggle/MobileTocToggle.scss +65 -59
- package/src/components/Search/README.md +1 -0
- package/src/components/Search/Search.astro +137 -109
- package/src/components/Search/Search.scss +20 -20
- package/src/components/SearchAdvanced/README.md +21 -15
- package/src/components/SearchAdvanced/SearchAdvanced.astro +205 -133
- package/src/components/SearchAdvanced/SearchAdvanced.scss +152 -153
- package/src/components/mdx/Anatomy/Anatomy.astro +51 -0
- package/src/components/mdx/Anatomy/Anatomy.scss +40 -0
- package/src/components/mdx/ApiLink/ApiLink.astro +133 -113
- package/src/components/mdx/ApiLink/ApiLink.scss +9 -9
- package/src/components/mdx/ApiLink/README.md +26 -22
- package/src/components/mdx/ApiLink/api-link-index.ts +196 -173
- package/src/components/mdx/ApiRef/ApiRef.astro +54 -51
- package/src/components/mdx/ApiRef/README.md +20 -15
- package/src/components/mdx/Badge/Badge.astro +14 -14
- package/src/components/mdx/Badge/Badge.scss +61 -56
- package/src/components/mdx/Badge/README.md +24 -19
- package/src/components/mdx/DocsAside/DocsAside.astro +30 -37
- package/src/components/mdx/DocsAside/DocsAside.scss +82 -82
- package/src/components/mdx/DocsAside/README.md +22 -22
- package/src/components/mdx/Faq/Faq.astro +86 -0
- package/src/components/mdx/Faq/Faq.scss +105 -0
- package/src/components/mdx/Faq/FaqItem.astro +117 -0
- package/src/components/mdx/Faq/README.md +223 -0
- package/src/components/mdx/Faq/types.ts +34 -0
- package/src/components/mdx/PlatformBlock/PlatformBlock.astro +3 -2
- package/src/components/mdx/PlatformBlock/README.md +6 -8
- package/src/components/mdx/Sample/README.md +21 -16
- package/src/components/mdx/Sample/Sample.astro +97 -74
- package/src/components/mdx/Sample/Sample.scss +132 -132
- package/src/content-helper.ts +71 -72
- package/src/content.config.ts +1 -6
- package/src/integration.ts +566 -512
- package/src/layouts/DocsLayout/DocsLayout.astro +228 -182
- package/src/layouts/DocsLayout/DocsLayout.scss +261 -261
- package/src/layouts/DocsLayout/README.md +24 -35
- package/src/lib/nav-helpers.ts +88 -82
- package/src/lib/types.ts +76 -76
- package/src/llms.ts +205 -166
- package/src/platform.ts +312 -162
- package/src/plugins/rehype-heading-anchors.ts +45 -45
- package/src/plugins/rehype-pagefind-ignore.ts +19 -19
- package/src/plugins/rehype-table-wrapper.ts +30 -30
- package/src/plugins/remark-docfx.ts +12 -0
- package/src/plugins/remark-env-vars.ts +12 -4
- package/src/plugins/remark-md-links.ts +10 -4
- package/src/scripts/icon-manifest.ts +13 -5
- package/src/scripts/sample-widget.ts +557 -501
- package/src/sidebar.ts +103 -97
- package/src/styles/global/_code-blocks.scss +43 -44
- package/src/styles/global/_component-themes.scss +151 -153
- package/src/styles/global/_icon-gallery.scss +81 -81
- package/src/styles/global/_index.scss +0 -1
- package/src/styles/global/_markdown.scss +816 -787
- package/src/styles/global/_palette.scss +456 -110
- package/src/styles/global/_search-shared.scss +402 -398
- package/src/styles/global/_type-scale.scss +127 -127
- package/src/styles/global/_variables.scss +138 -111
- package/src/styles/theme.scss +41 -41
- package/src/virtual-modules.d.ts +11 -2
package/src/llms.ts
CHANGED
|
@@ -19,20 +19,20 @@ import matter from 'gray-matter';
|
|
|
19
19
|
|
|
20
20
|
/** LLM-facing metadata for a documentation page, derived from frontmatter. */
|
|
21
21
|
export interface LlmsMeta {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
/** Description shown in llms.txt. Precedence: llms.description > llmsdescription > description */
|
|
23
|
+
description?: string;
|
|
24
|
+
/** Keyword tags. Precedence: llms.keywords > llmskeywords */
|
|
25
|
+
keywords?: string[];
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/** A named documentation subset that generates its own combined .txt file under /_llms-txt/. */
|
|
29
29
|
export interface LlmsSet {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
/** Display label — also used to derive the URL slug (e.g. "React Grids" → /_llms-txt/react-grids.txt). */
|
|
31
|
+
label: string;
|
|
32
|
+
/** Glob patterns matching page slugs to include. */
|
|
33
|
+
paths: string[];
|
|
34
|
+
/** Short description shown next to the link in llms.txt. */
|
|
35
|
+
description?: string;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
// ---------------------------------------------------------------------------
|
|
@@ -40,20 +40,20 @@ export interface LlmsSet {
|
|
|
40
40
|
// ---------------------------------------------------------------------------
|
|
41
41
|
|
|
42
42
|
export interface SidebarItem {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
label?: string;
|
|
44
|
+
slug?: string;
|
|
45
|
+
items?: SidebarItem[];
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
interface FrontmatterData {
|
|
49
|
-
|
|
49
|
+
title?: string;
|
|
50
|
+
description?: string;
|
|
51
|
+
llmsdescription?: string;
|
|
52
|
+
llmskeywords?: string | string[];
|
|
53
|
+
llms?: {
|
|
50
54
|
description?: string;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
llms?: {
|
|
54
|
-
description?: string;
|
|
55
|
-
keywords?: string[];
|
|
56
|
-
};
|
|
55
|
+
keywords?: string[];
|
|
56
|
+
};
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
// ---------------------------------------------------------------------------
|
|
@@ -61,24 +61,26 @@ interface FrontmatterData {
|
|
|
61
61
|
// ---------------------------------------------------------------------------
|
|
62
62
|
|
|
63
63
|
export function extractLlmsMeta(raw: string): LlmsMeta {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
64
|
+
let data: FrontmatterData;
|
|
65
|
+
try {
|
|
66
|
+
data = matter(raw).data as FrontmatterData;
|
|
67
|
+
} catch {
|
|
68
|
+
return {};
|
|
69
|
+
}
|
|
70
|
+
const description: string | undefined =
|
|
71
|
+
data.llms?.description ??
|
|
72
|
+
(typeof data.llmsdescription === 'string' ? data.llmsdescription : undefined) ??
|
|
73
|
+
(typeof data.description === 'string' ? data.description : undefined);
|
|
74
|
+
const rawKw = data.llms?.keywords ?? data.llmskeywords;
|
|
75
|
+
const keywords: string[] | undefined = Array.isArray(rawKw)
|
|
76
|
+
? rawKw
|
|
77
|
+
: typeof rawKw === 'string'
|
|
78
|
+
? [rawKw]
|
|
79
|
+
: undefined;
|
|
80
|
+
return {
|
|
81
|
+
...(description !== undefined ? { description } : {}),
|
|
82
|
+
...(keywords?.length ? { keywords } : {}),
|
|
83
|
+
};
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
// ---------------------------------------------------------------------------
|
|
@@ -86,10 +88,10 @@ export function extractLlmsMeta(raw: string): LlmsMeta {
|
|
|
86
88
|
// ---------------------------------------------------------------------------
|
|
87
89
|
|
|
88
90
|
export function collectSlugs(items: SidebarItem[]): string[] {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
return items.flatMap((item) => [
|
|
92
|
+
...(typeof item.slug === 'string' ? [item.slug] : []),
|
|
93
|
+
...(Array.isArray(item.items) ? collectSlugs(item.items) : []),
|
|
94
|
+
]);
|
|
93
95
|
}
|
|
94
96
|
|
|
95
97
|
// ---------------------------------------------------------------------------
|
|
@@ -97,18 +99,20 @@ export function collectSlugs(items: SidebarItem[]): string[] {
|
|
|
97
99
|
// ---------------------------------------------------------------------------
|
|
98
100
|
|
|
99
101
|
export function buildLlmsMetaMap(docsDir: string, items: SidebarItem[]): Map<string, LlmsMeta> {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
102
|
+
const map = new Map<string, LlmsMeta>();
|
|
103
|
+
for (const slug of collectSlugs(items)) {
|
|
104
|
+
for (const ext of ['.md', '.mdx']) {
|
|
105
|
+
try {
|
|
106
|
+
const raw = fs.readFileSync(path.join(docsDir, slug + ext), 'utf-8');
|
|
107
|
+
const meta = extractLlmsMeta(raw);
|
|
108
|
+
if (meta.description || meta.keywords?.length) map.set(slug, meta);
|
|
109
|
+
break;
|
|
110
|
+
} catch {
|
|
111
|
+
/* try next ext */
|
|
112
|
+
}
|
|
110
113
|
}
|
|
111
|
-
|
|
114
|
+
}
|
|
115
|
+
return map;
|
|
112
116
|
}
|
|
113
117
|
|
|
114
118
|
// ---------------------------------------------------------------------------
|
|
@@ -117,7 +121,10 @@ export function buildLlmsMetaMap(docsDir: string, items: SidebarItem[]): Map<str
|
|
|
117
121
|
|
|
118
122
|
/** Derives a URL-safe slug from a label (matches github-slugger for plain ASCII). */
|
|
119
123
|
export function toUrlSlug(label: string): string {
|
|
120
|
-
|
|
124
|
+
return label
|
|
125
|
+
.toLowerCase()
|
|
126
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
127
|
+
.replace(/^-|-$/, '');
|
|
121
128
|
}
|
|
122
129
|
|
|
123
130
|
// ---------------------------------------------------------------------------
|
|
@@ -129,23 +136,23 @@ export function toUrlSlug(label: string): string {
|
|
|
129
136
|
* These labels are treated as organisational groupings, never as label prefixes.
|
|
130
137
|
*/
|
|
131
138
|
export const IGDOCS_BROAD_SECTIONS = [
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
139
|
+
'AI-Assisted Development',
|
|
140
|
+
'General',
|
|
141
|
+
'Interactivity',
|
|
142
|
+
'Grids & Lists',
|
|
143
|
+
'Dashboards',
|
|
144
|
+
'Charts',
|
|
145
|
+
'Maps',
|
|
146
|
+
'Layouts',
|
|
147
|
+
'Menus',
|
|
148
|
+
'Frameworks',
|
|
149
|
+
'Gauges',
|
|
150
|
+
'Data Entry & Display',
|
|
151
|
+
'Interactions',
|
|
152
|
+
'Notifications',
|
|
153
|
+
'Scheduling',
|
|
154
|
+
'Styling & Themes',
|
|
155
|
+
'Deprecated Components',
|
|
149
156
|
] as const;
|
|
150
157
|
|
|
151
158
|
/** Platforms that use the Ignite UI doc broad sections. */
|
|
@@ -156,35 +163,54 @@ const IGDOCS_PLATFORMS = new Set<string>(['angular', 'react', 'blazor', 'web-com
|
|
|
156
163
|
* Returns an empty set for platforms with no defined broad sections (appbuilder, slingshot).
|
|
157
164
|
*/
|
|
158
165
|
export function getBroadSectionsForPlatform(platform: string | null): ReadonlySet<string> {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
166
|
+
if (platform !== null && IGDOCS_PLATFORMS.has(platform)) {
|
|
167
|
+
return new Set(IGDOCS_BROAD_SECTIONS);
|
|
168
|
+
}
|
|
169
|
+
return new Set();
|
|
163
170
|
}
|
|
164
171
|
|
|
165
172
|
/** Returns `true` when the label is a broad navigation bucket, not a meaningful label prefix. */
|
|
166
173
|
function isBroadSection(label: string, broadSections: ReadonlySet<string>): boolean {
|
|
167
|
-
|
|
174
|
+
return broadSections.has(label);
|
|
168
175
|
}
|
|
169
176
|
|
|
170
177
|
// ---------------------------------------------------------------------------
|
|
171
178
|
|
|
172
179
|
const GENERIC_WORDS = new Set([
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
180
|
+
'Overview',
|
|
181
|
+
'Introduction',
|
|
182
|
+
'Getting Started',
|
|
183
|
+
'Quick Start',
|
|
184
|
+
'Examples',
|
|
185
|
+
'Reference',
|
|
186
|
+
'Guide',
|
|
187
|
+
'Tutorial',
|
|
188
|
+
'Configuration',
|
|
189
|
+
'Usage',
|
|
190
|
+
'Theming',
|
|
191
|
+
'Sorting',
|
|
192
|
+
'Editing',
|
|
193
|
+
'Filtering',
|
|
194
|
+
'Grouping',
|
|
195
|
+
'Paging',
|
|
196
|
+
'Selection',
|
|
197
|
+
'Summaries',
|
|
198
|
+
'Toolbar',
|
|
199
|
+
'Export',
|
|
200
|
+
'Virtualization',
|
|
201
|
+
'Accessibility',
|
|
202
|
+
'Localization',
|
|
203
|
+
'Styling',
|
|
178
204
|
]);
|
|
179
205
|
|
|
180
206
|
function isGeneric(label: string): boolean {
|
|
181
|
-
|
|
207
|
+
return GENERIC_WORDS.has(label) || [...GENERIC_WORDS].some((w) => label.startsWith(w + ' '));
|
|
182
208
|
}
|
|
183
209
|
|
|
184
210
|
/** Strips a leading `"<prefix> "` from label if present, avoiding "Editing Editing Overview". */
|
|
185
211
|
function stripLeadingDuplicate(label: string, prefix: string): string {
|
|
186
|
-
|
|
187
|
-
|
|
212
|
+
const candidate = `${prefix} `;
|
|
213
|
+
return label.startsWith(candidate) ? label.slice(candidate.length) : label;
|
|
188
214
|
}
|
|
189
215
|
|
|
190
216
|
/**
|
|
@@ -206,26 +232,30 @@ function stripLeadingDuplicate(label: string, prefix: string): string {
|
|
|
206
232
|
* - specific label → `component label` e.g. "Grid Cell Editing"
|
|
207
233
|
* (stripLeadingDuplicate avoids "Grid Editing Editing Overview")
|
|
208
234
|
*/
|
|
209
|
-
function buildLabel(
|
|
210
|
-
|
|
211
|
-
|
|
235
|
+
function buildLabel(
|
|
236
|
+
label: string,
|
|
237
|
+
ancestorPath: string[],
|
|
238
|
+
broadSections: ReadonlySet<string> = new Set(),
|
|
239
|
+
): string {
|
|
240
|
+
// Strip navigation buckets — they are not useful label prefixes.
|
|
241
|
+
const filtered = ancestorPath.filter((a) => !isBroadSection(a, broadSections));
|
|
212
242
|
|
|
213
|
-
|
|
243
|
+
if (filtered.length === 0) return label;
|
|
214
244
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
245
|
+
if (filtered.length === 1) {
|
|
246
|
+
const parent = filtered[0];
|
|
247
|
+
return isGeneric(label) ? `${parent} ${label}` : label;
|
|
248
|
+
}
|
|
219
249
|
|
|
220
|
-
|
|
221
|
-
|
|
250
|
+
const component = filtered[filtered.length - 2];
|
|
251
|
+
const subsection = filtered[filtered.length - 1];
|
|
222
252
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
253
|
+
if (isGeneric(label)) {
|
|
254
|
+
const deduped = stripLeadingDuplicate(label, subsection);
|
|
255
|
+
return `${component} ${subsection} ${deduped}`;
|
|
256
|
+
}
|
|
227
257
|
|
|
228
|
-
|
|
258
|
+
return `${component} ${label}`;
|
|
229
259
|
}
|
|
230
260
|
|
|
231
261
|
// ---------------------------------------------------------------------------
|
|
@@ -233,50 +263,50 @@ function buildLabel(label: string, ancestorPath: string[], broadSections: Readon
|
|
|
233
263
|
// ---------------------------------------------------------------------------
|
|
234
264
|
|
|
235
265
|
function walkLlmsItems(
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
266
|
+
items: SidebarItem[],
|
|
267
|
+
base: string,
|
|
268
|
+
lines: string[],
|
|
269
|
+
meta: Record<string, LlmsMeta>,
|
|
270
|
+
seen: Set<string>,
|
|
271
|
+
ancestorPath: string[] = [],
|
|
272
|
+
depth = 0,
|
|
273
|
+
broadSections: ReadonlySet<string> = new Set(),
|
|
244
274
|
): void {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
}
|
|
261
|
-
if (Array.isArray(item.items) && item.items.length > 0) groups.push(item);
|
|
275
|
+
const groups: SidebarItem[] = [];
|
|
276
|
+
|
|
277
|
+
for (const item of items) {
|
|
278
|
+
if (item.slug !== undefined) {
|
|
279
|
+
const slug = item.slug === '' ? 'index' : item.slug;
|
|
280
|
+
if (seen.has(slug)) continue;
|
|
281
|
+
seen.add(slug);
|
|
282
|
+
|
|
283
|
+
const label = buildLabel(item.label ?? slug, ancestorPath, broadSections);
|
|
284
|
+
const m = meta[slug];
|
|
285
|
+
let line = `- [${label}](${base}/${slug}.md)`;
|
|
286
|
+
if (m?.description) line += `: ${m.description}`;
|
|
287
|
+
lines.push(line);
|
|
288
|
+
if (m?.keywords?.length) lines.push(` Tags: ${m.keywords.join(', ')}`);
|
|
289
|
+
continue;
|
|
262
290
|
}
|
|
291
|
+
if (Array.isArray(item.items) && item.items.length > 0) groups.push(item);
|
|
292
|
+
}
|
|
263
293
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
}
|
|
269
|
-
walkLlmsItems(
|
|
270
|
-
group.items!,
|
|
271
|
-
base,
|
|
272
|
-
lines,
|
|
273
|
-
meta,
|
|
274
|
-
seen,
|
|
275
|
-
[...ancestorPath, group.label ?? ''],
|
|
276
|
-
depth + 1,
|
|
277
|
-
broadSections,
|
|
278
|
-
);
|
|
294
|
+
for (const group of groups) {
|
|
295
|
+
if (depth < 3) {
|
|
296
|
+
const headingLevel = depth === 0 ? 2 : depth + 2;
|
|
297
|
+
lines.push('', `${'#'.repeat(headingLevel)} ${group.label}`, '');
|
|
279
298
|
}
|
|
299
|
+
walkLlmsItems(
|
|
300
|
+
group.items!,
|
|
301
|
+
base,
|
|
302
|
+
lines,
|
|
303
|
+
meta,
|
|
304
|
+
seen,
|
|
305
|
+
[...ancestorPath, group.label ?? ''],
|
|
306
|
+
depth + 1,
|
|
307
|
+
broadSections,
|
|
308
|
+
);
|
|
309
|
+
}
|
|
280
310
|
}
|
|
281
311
|
|
|
282
312
|
// ---------------------------------------------------------------------------
|
|
@@ -284,32 +314,41 @@ function walkLlmsItems(
|
|
|
284
314
|
// ---------------------------------------------------------------------------
|
|
285
315
|
|
|
286
316
|
export function buildLlmsTxt(
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
317
|
+
base: string,
|
|
318
|
+
siteTitle: string,
|
|
319
|
+
siteDescription: string,
|
|
320
|
+
sidebarItems: SidebarItem[],
|
|
321
|
+
metaMap: Map<string, LlmsMeta>,
|
|
322
|
+
llmsSets: LlmsSet[] = [],
|
|
323
|
+
broadSections: ReadonlySet<string> = new Set(),
|
|
294
324
|
): string {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
325
|
+
const lines: string[] = [
|
|
326
|
+
`# ${siteTitle}`,
|
|
327
|
+
'',
|
|
328
|
+
`> ${siteDescription}`,
|
|
329
|
+
'',
|
|
330
|
+
'## Documentation sets',
|
|
331
|
+
'',
|
|
332
|
+
`- [Abridged documentation](${base}/llms-small.txt): a compact version of the documentation, with non-essential content removed`,
|
|
333
|
+
`- [Combined docs](${base}/llms-full.txt): Single-file Markdown export of all docs.`,
|
|
334
|
+
``,
|
|
335
|
+
];
|
|
336
|
+
|
|
337
|
+
for (const set of llmsSets) {
|
|
338
|
+
const slug = toUrlSlug(set.label);
|
|
339
|
+
const link = `- [${set.label}](${base}/_llms-txt/${slug}.txt)`;
|
|
340
|
+
lines.push(set.description ? `${link}: ${set.description}` : link);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
walkLlmsItems(
|
|
344
|
+
sidebarItems,
|
|
345
|
+
base,
|
|
346
|
+
lines,
|
|
347
|
+
Object.fromEntries(metaMap),
|
|
348
|
+
new Set(),
|
|
349
|
+
[],
|
|
350
|
+
0,
|
|
351
|
+
broadSections,
|
|
352
|
+
);
|
|
353
|
+
return lines.join('\n');
|
|
315
354
|
}
|