docusaurus-plugin-llms 0.1.4 → 0.1.5
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 +1 -1
- package/lib/generator.js +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +2 -2
- package/lib/processor.d.ts +1 -1
- package/lib/processor.js +7 -1
- package/package.json +2 -2
- package/src/generator.ts +1 -1
- package/src/index.ts +2 -2
- package/src/processor.ts +9 -2
package/README.md
CHANGED
@@ -345,7 +345,7 @@ The generated files will include the version information under the description:
|
|
345
345
|
|
346
346
|
Version: 1.0.0
|
347
347
|
|
348
|
-
This file contains all documentation content in a single document following the
|
348
|
+
This file contains all documentation content in a single document following the llmstxt.org standard.
|
349
349
|
```
|
350
350
|
|
351
351
|
## How It Works
|
package/lib/generator.js
CHANGED
@@ -84,7 +84,7 @@ ${doc.content}`;
|
|
84
84
|
|
85
85
|
> ${fileDescription}${versionInfo}
|
86
86
|
|
87
|
-
This file contains all documentation content in a single document following the
|
87
|
+
This file contains all documentation content in a single document following the llmstxt.org standard.
|
88
88
|
|
89
89
|
${fullContentSections.join('\n\n---\n\n')}
|
90
90
|
`;
|
package/lib/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @fileoverview Docusaurus plugin that generates LLM-friendly documentation following the
|
2
|
+
* @fileoverview Docusaurus plugin that generates LLM-friendly documentation following the llmstxt.org standard.
|
3
3
|
*
|
4
4
|
* This plugin creates two files:
|
5
5
|
* - llms.txt: Contains links to all sections of documentation
|
@@ -11,7 +11,7 @@ import type { LoadContext, Plugin } from '@docusaurus/types';
|
|
11
11
|
import { PluginOptions } from './types';
|
12
12
|
/**
|
13
13
|
* A Docusaurus plugin to generate LLM-friendly documentation following
|
14
|
-
* the
|
14
|
+
* the llmstxt.org standard
|
15
15
|
*
|
16
16
|
* @param context - Docusaurus context
|
17
17
|
* @param options - Plugin options
|
package/lib/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
/**
|
3
|
-
* @fileoverview Docusaurus plugin that generates LLM-friendly documentation following the
|
3
|
+
* @fileoverview Docusaurus plugin that generates LLM-friendly documentation following the llmstxt.org standard.
|
4
4
|
*
|
5
5
|
* This plugin creates two files:
|
6
6
|
* - llms.txt: Contains links to all sections of documentation
|
@@ -13,7 +13,7 @@ exports.default = docusaurusPluginLLMs;
|
|
13
13
|
const generator_1 = require("./generator");
|
14
14
|
/**
|
15
15
|
* A Docusaurus plugin to generate LLM-friendly documentation following
|
16
|
-
* the
|
16
|
+
* the llmstxt.org standard
|
17
17
|
*
|
18
18
|
* @param context - Docusaurus context
|
19
19
|
* @param options - Plugin options
|
package/lib/processor.d.ts
CHANGED
@@ -14,7 +14,7 @@ import { DocInfo, PluginContext } from './types';
|
|
14
14
|
export declare function processMarkdownFile(filePath: string, baseDir: string, siteUrl: string, pathPrefix?: string, pathTransformation?: {
|
15
15
|
ignorePaths?: string[];
|
16
16
|
addPaths?: string[];
|
17
|
-
}): Promise<DocInfo>;
|
17
|
+
}): Promise<DocInfo | null>;
|
18
18
|
/**
|
19
19
|
* Process files based on include patterns, ignore patterns, and ordering
|
20
20
|
* @param context - Plugin context
|
package/lib/processor.js
CHANGED
@@ -57,6 +57,10 @@ const utils_1 = require("./utils");
|
|
57
57
|
async function processMarkdownFile(filePath, baseDir, siteUrl, pathPrefix = 'docs', pathTransformation) {
|
58
58
|
const content = await (0, utils_1.readFile)(filePath);
|
59
59
|
const { data, content: markdownContent } = (0, gray_matter_1.default)(content);
|
60
|
+
// Skip draft files
|
61
|
+
if (data.draft === true) {
|
62
|
+
return null;
|
63
|
+
}
|
60
64
|
const relativePath = path.relative(baseDir, filePath);
|
61
65
|
// Convert to URL path format (replace backslashes with forward slashes on Windows)
|
62
66
|
const normalizedPath = relativePath.replace(/\\/g, '/');
|
@@ -201,7 +205,9 @@ async function processFilesWithPatterns(context, allFiles, includePatterns = [],
|
|
201
205
|
const baseDir = isBlogFile ? path.join(siteDir, 'blog') : path.join(siteDir, docsDir);
|
202
206
|
const pathPrefix = isBlogFile ? 'blog' : 'docs';
|
203
207
|
const docInfo = await processMarkdownFile(filePath, baseDir, siteUrl, pathPrefix, context.options.pathTransformation);
|
204
|
-
|
208
|
+
if (docInfo !== null) {
|
209
|
+
processedDocs.push(docInfo);
|
210
|
+
}
|
205
211
|
}
|
206
212
|
catch (err) {
|
207
213
|
console.warn(`Error processing ${filePath}: ${err.message}`);
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "docusaurus-plugin-llms",
|
3
|
-
"version": "0.1.
|
4
|
-
"description": "Docusaurus plugin for generating LLM-friendly documentation following the
|
3
|
+
"version": "0.1.5",
|
4
|
+
"description": "Docusaurus plugin for generating LLM-friendly documentation following the llmstxt.org standard",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"types": "lib/index.d.ts",
|
7
7
|
"scripts": {
|
package/src/generator.ts
CHANGED
@@ -60,7 +60,7 @@ ${doc.content}`;
|
|
60
60
|
|
61
61
|
> ${fileDescription}${versionInfo}
|
62
62
|
|
63
|
-
This file contains all documentation content in a single document following the
|
63
|
+
This file contains all documentation content in a single document following the llmstxt.org standard.
|
64
64
|
|
65
65
|
${fullContentSections.join('\n\n---\n\n')}
|
66
66
|
`;
|
package/src/index.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @fileoverview Docusaurus plugin that generates LLM-friendly documentation following the
|
2
|
+
* @fileoverview Docusaurus plugin that generates LLM-friendly documentation following the llmstxt.org standard.
|
3
3
|
*
|
4
4
|
* This plugin creates two files:
|
5
5
|
* - llms.txt: Contains links to all sections of documentation
|
@@ -15,7 +15,7 @@ import { collectDocFiles, generateStandardLLMFiles, generateCustomLLMFiles } fro
|
|
15
15
|
|
16
16
|
/**
|
17
17
|
* A Docusaurus plugin to generate LLM-friendly documentation following
|
18
|
-
* the
|
18
|
+
* the llmstxt.org standard
|
19
19
|
*
|
20
20
|
* @param context - Docusaurus context
|
21
21
|
* @param options - Plugin options
|
package/src/processor.ts
CHANGED
@@ -31,10 +31,15 @@ export async function processMarkdownFile(
|
|
31
31
|
ignorePaths?: string[];
|
32
32
|
addPaths?: string[];
|
33
33
|
}
|
34
|
-
): Promise<DocInfo> {
|
34
|
+
): Promise<DocInfo | null> {
|
35
35
|
const content = await readFile(filePath);
|
36
36
|
const { data, content: markdownContent } = matter(content);
|
37
37
|
|
38
|
+
// Skip draft files
|
39
|
+
if (data.draft === true) {
|
40
|
+
return null;
|
41
|
+
}
|
42
|
+
|
38
43
|
const relativePath = path.relative(baseDir, filePath);
|
39
44
|
// Convert to URL path format (replace backslashes with forward slashes on Windows)
|
40
45
|
const normalizedPath = relativePath.replace(/\\/g, '/');
|
@@ -226,7 +231,9 @@ export async function processFilesWithPatterns(
|
|
226
231
|
pathPrefix,
|
227
232
|
context.options.pathTransformation
|
228
233
|
);
|
229
|
-
|
234
|
+
if (docInfo !== null) {
|
235
|
+
processedDocs.push(docInfo);
|
236
|
+
}
|
230
237
|
} catch (err: any) {
|
231
238
|
console.warn(`Error processing ${filePath}: ${err.message}`);
|
232
239
|
}
|