
Research
/Security News
Toptalβs GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptalβs GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
docusaurus-plugin-llms
Advanced tools
Docusaurus plugin for generating LLM-friendly documentation following the llmstxt.org standard
A Docusaurus plugin for generating LLM-friendly documentation following the llmstxt standard.
llms.txt
with section linksllms-full.txt
with all content in one filenpm install docusaurus-plugin-llms --save-dev
Then add to your Docusaurus configuration:
module.exports = {
// ... your existing Docusaurus config
plugins: [
'docusaurus-plugin-llms',
// ... your other plugins
],
};
You can configure the plugin by passing options:
module.exports = {
// ... your existing Docusaurus config
plugins: [
[
'docusaurus-plugin-llms',
{
// Options here
generateLLMsTxt: true,
generateLLMsFullTxt: true,
docsDir: 'docs',
ignoreFiles: ['advanced/*', 'private/*'],
title: 'My Project Documentation',
description: 'Complete reference documentation for My Project',
includeBlog: true,
// Control documentation order
includeOrder: [
'getting-started/*',
'guides/*',
'api/*',
],
includeUnmatchedLast: true,
// Path transformation options
pathTransformation: {
// Paths to ignore when constructing URLs (will be removed if found)
ignorePaths: ['docs'],
// Paths to add when constructing URLs (will be prepended if not already present)
addPaths: ['api'],
},
// Custom LLM files for specific documentation sections
customLLMFiles: [
{
filename: 'llms-python.txt',
includePatterns: ['api/python/**/*.md', 'guides/python/*.md'],
fullContent: true,
title: 'Python API Documentation',
description: 'Complete reference for Python API'
},
{
filename: 'llms-tutorials.txt',
includePatterns: ['tutorials/**/*.md'],
fullContent: false,
title: 'Tutorial Documentation',
description: 'All tutorials in a single file'
}
],
},
],
// ... your other plugins
],
};
Option | Type | Default | Description |
---|---|---|---|
description | string | Site tagline | Custom description to use in generated files |
docsDir | string | 'docs' | Base directory for documentation files |
generateLLMsFullTxt | boolean | true | Whether to generate the full content file |
generateLLMsTxt | boolean | true | Whether to generate the links file |
ignoreFiles | string[] | [] | Array of glob patterns for files to ignore |
includeBlog | boolean | false | Whether to include blog content |
includeOrder | string[] | [] | Array of glob patterns for files to process in specific order |
includeUnmatchedLast | boolean | true | Whether to include unmatched files at the end |
llmsFullTxtFilename | string | 'llms-full.txt' | Custom filename for the full content file |
llmsTxtFilename | string | 'llms.txt' | Custom filename for the links file |
pathTransformation.addPaths | string[] | [] | Path segments to add when constructing URLs |
pathTransformation.ignorePaths | string[] | [] | Path segments to ignore when constructing URLs |
pathTransformation | object | undefined | Path transformation options for URL construction |
title | string | Site title | Custom title to use in generated files |
version | string | undefined | Global version to include in all generated files |
customLLMFiles | array | [] | Array of custom LLM file configurations |
The path transformation feature allows you to manipulate how URLs are constructed from file paths:
Example 1: Remove 'docs' from the URL path
pathTransformation: {
ignorePaths: ['docs'],
}
File path: /content/docs/manual/decorators.md
β URL: https://example.com/manual/decorators
Example 2: Add 'api' to the URL path
pathTransformation: {
addPaths: ['api'],
}
File path: /content/manual/decorators.md
β URL: https://example.com/api/manual/decorators
Example 3: Combine both transformations
pathTransformation: {
ignorePaths: ['docs'],
addPaths: ['api'],
}
File path: /content/docs/manual/decorators.md
β URL: https://example.com/api/manual/decorators
The configuration supports multiple path segments in both arrays.
The document ordering feature allows you to control the sequence in which files appear in the generated output:
Example 1: Basic Section Ordering
includeOrder: [
'getting-started/*',
'guides/*',
'api/*',
'advanced/*'
]
Result: Files will appear in the generated output following this section order.
Example 2: Strict Inclusion List
includeOrder: [
'public-docs/**/*.md'
],
includeUnmatchedLast: false
Result: Only files matching 'public-docs/**/*.md' are included, all others are excluded.
Example 3: Detailed Ordering with Specific Files First
includeOrder: [
'getting-started/installation.md',
'getting-started/quick-start.md',
'getting-started/*.md',
'api/core/*.md',
'api/plugins/*.md',
'api/**/*.md'
]
Result: Installation and quick-start guides appear first, followed by other getting-started files, then API documentation in a specific order.
In addition to the standard llms.txt
and llms-full.txt
files, you can generate custom LLM-friendly files for different sections of your documentation with the customLLMFiles
option:
customLLMFiles: [
{
filename: 'llms-python.txt',
includePatterns: ['api/python/**/*.md', 'guides/python/*.md'],
fullContent: true,
title: 'Python API Documentation',
description: 'Complete reference for Python API'
},
{
filename: 'llms-tutorials.txt',
includePatterns: ['tutorials/**/*.md'],
fullContent: false,
title: 'Tutorial Documentation',
description: 'All tutorials in a single file'
}
]
Each custom LLM file is defined by an object with the following properties:
Option | Type | Required | Description |
---|---|---|---|
filename | string | Yes | Name of the output file (e.g., 'llms-python.txt') |
includePatterns | string[] | Yes | Glob patterns for files to include |
fullContent | boolean | Yes | true for full content like llms-full.txt, false for links only like llms.txt |
title | string | No | Custom title for this file (defaults to site title) |
description | string | No | Custom description for this file (defaults to site description) |
ignorePatterns | string[] | No | Additional patterns to exclude (combined with global ignoreFiles) |
orderPatterns | string[] | No | Order patterns for controlling file ordering (similar to includeOrder) |
includeUnmatchedLast | boolean | No | Whether to include unmatched files last (default: false) |
version | string | No | Version information for this LLM file (overrides global version) |
Create separate files for different programming languages:
customLLMFiles: [
{
filename: 'llms-python.txt',
includePatterns: ['api/python/**/*.md', 'guides/python/*.md'],
fullContent: true,
title: 'Python API Documentation'
},
{
filename: 'llms-javascript.txt',
includePatterns: ['api/javascript/**/*.md', 'guides/javascript/*.md'],
fullContent: true,
title: 'JavaScript API Documentation'
}
]
Separate tutorials from API reference:
customLLMFiles: [
{
filename: 'llms-tutorials.txt',
includePatterns: ['tutorials/**/*.md', 'guides/**/*.md'],
fullContent: true,
title: 'Tutorials and Guides'
},
{
filename: 'llms-api.txt',
includePatterns: ['api/**/*.md', 'reference/**/*.md'],
fullContent: true,
title: 'API Reference'
}
]
Create a beginner-focused file with carefully ordered content:
customLLMFiles: [
{
filename: 'llms-getting-started.txt',
includePatterns: ['**/*.md'],
ignorePatterns: ['advanced/**/*.md', 'internal/**/*.md'],
orderPatterns: [
'introduction.md',
'getting-started/*.md',
'tutorials/basic/*.md',
'examples/simple/*.md'
],
fullContent: true,
title: 'Getting Started Guide',
description: 'Beginner-friendly documentation with essential concepts'
}
]
Include version information in your documentation files:
plugins: [
[
'docusaurus-plugin-llms',
{
// Global version applies to all files
version: '2.0.0',
// Custom LLM files with specific versions
customLLMFiles: [
{
filename: 'api-reference.txt',
title: 'API Reference Documentation',
description: 'Complete API reference for developers',
includePatterns: ['**/api/**/*.md', '**/reference/**/*.md'],
fullContent: true,
version: '1.0.0' // Overrides global version
},
{
filename: 'tutorials.txt',
title: 'Tutorials and Guides',
description: 'Step-by-step tutorials and guides',
includePatterns: ['**/tutorials/**/*.md', '**/guides/**/*.md'],
fullContent: true,
version: '0.9.5-beta' // Overrides global version
}
]
}
],
]
The generated files will include the version information under the description:
# API Reference Documentation
> Complete API reference for developers
Version: 1.0.0
This file contains all documentation content in a single document following the llmstxt.org standard.
This plugin automatically generates the following files during the build process:
These files follow the llmstxt standard, making your documentation optimized for use with Large Language Models (LLMs).
The plugin:
docs
directory recursively for all Markdown filesllms.txt
llms-full.txt
The plugin includes comprehensive tests in the tests
directory:
To run the tests:
# Run all tests
npm test
# Run just the unit tests
npm run test:unit
# Run just the integration tests
npm run test:integration
For more detailed testing instructions, see tests/TESTING.md.
Planned features for future versions:
This project is licensed under the MIT License.
FAQs
Docusaurus plugin for generating LLM-friendly documentation following the llmstxt.org standard
The npm package docusaurus-plugin-llms receives a total of 1,527 weekly downloads. As such, docusaurus-plugin-llms popularity was classified as popular.
We found that docusaurus-plugin-llms demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Β It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Threat actors hijacked Toptalβs GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.