@redpanda-data/docs-extensions-and-macros 5.22.0 → 5.22.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.
|
@@ -71,10 +71,36 @@ function stripMarkdownMetadata(content) {
|
|
|
71
71
|
return text.trim();
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Return the subset of `components` that have at least one page in `pages` —
|
|
76
|
+
* i.e. the components that actually get a generated `<name>-full.txt` export.
|
|
77
|
+
*
|
|
78
|
+
* A `<name>-full.txt` file is only written for components that have pages, so
|
|
79
|
+
* advertising an export for a corpus-less landing/utility component (e.g.
|
|
80
|
+
* `data-platform`, `self-managed`, `search`) links the AI index to a 404.
|
|
81
|
+
* Filtering the advertised list through this helper keeps it in sync with the
|
|
82
|
+
* files that are actually produced. Input order is preserved.
|
|
83
|
+
*
|
|
84
|
+
* @param {Array<{name: string}>} components - All components from the content catalog
|
|
85
|
+
* @param {Array<{src?: {component?: string}}>} pages - Pages that will be exported
|
|
86
|
+
* @returns {Array<{name: string}>} Components that have at least one page
|
|
87
|
+
*/
|
|
88
|
+
function componentsWithExports(components, pages) {
|
|
89
|
+
const componentNames = new Set(
|
|
90
|
+
(pages || [])
|
|
91
|
+
.map((page) => page && page.src && page.src.component)
|
|
92
|
+
.filter(Boolean)
|
|
93
|
+
);
|
|
94
|
+
return (components || []).filter((component) =>
|
|
95
|
+
componentNames.has(component.name)
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
74
99
|
module.exports = {
|
|
75
100
|
LLMS_DIRECTIVE_BASE,
|
|
76
101
|
LLMS_DIRECTIVE_REGEX,
|
|
77
102
|
SOURCE_COMMENT_REGEX,
|
|
78
103
|
formatLlmsDirective,
|
|
79
104
|
stripMarkdownMetadata,
|
|
105
|
+
componentsWithExports,
|
|
80
106
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const { raiseListenerLimit } = require('./util/raise-listener-limit')
|
|
4
4
|
|
|
5
5
|
const { toMarkdownUrl } = require('../extension-utils/url-utils');
|
|
6
|
-
const { stripMarkdownMetadata } = require('../extension-utils/llms-utils');
|
|
6
|
+
const { stripMarkdownMetadata, componentsWithExports } = require('../extension-utils/llms-utils');
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Extracts markdown from llms.adoc page and generates AI-friendly documentation exports.
|
|
@@ -167,7 +167,11 @@ module.exports.register = function () {
|
|
|
167
167
|
fullContent += `- **${siteUrl}/llms.txt**: Curated overview following the llms.txt standard - start here for a quick introduction\n`;
|
|
168
168
|
fullContent += `- **${siteUrl}/llms-full.txt**: Complete documentation export (this file) - comprehensive reference with all pages\n`;
|
|
169
169
|
fullContent += `- **Component-specific exports**: Focused documentation for individual products:\n`;
|
|
170
|
-
components
|
|
170
|
+
// Only advertise exports for components that actually have pages — a
|
|
171
|
+
// `<name>-full.txt` is generated per component below, so listing corpus-less
|
|
172
|
+
// landing/utility components (e.g. data-platform, self-managed, search) would
|
|
173
|
+
// point the AI index at a 404.
|
|
174
|
+
componentsWithExports(components, pages).forEach(component => {
|
|
171
175
|
fullContent += ` - \`${siteUrl}/${component.name}-full.txt\`: ${component.title}\n`;
|
|
172
176
|
});
|
|
173
177
|
fullContent += `- **Individual markdown pages**: Each HTML page has a corresponding .md file (e.g., \`/docs/page.html\` → \`/docs/page.md\`)\n\n`;
|