docusaurus-plugin-generate-llms-txt
v0.0.1
Published
A docusaurus plugin that generates a concatenated markdown file from your documentation.
Downloads
10
Maintainers
Readme
Docusaurus llms.txt Generator
A Docusaurus plugin that generates a concatenated markdown file from your documentation under /llms.txt
. This plugin helps make your documentation AI-friendly by following the llms.txt specification, allowing AI models to better understand and process your documentation.
What is llms.txt?
llms.txt is a standard that helps AI models better understand your documentation by providing it in a single, concatenated file. This can improve the quality of AI responses when users ask questions about your project.
Installation
npm install docusaurus-plugin-generate-llms-txt
# or
yarn add docusaurus-plugin-generate-llms-txt
Usage
Add the plugin to your docusaurus.config.js
:
// docusaurus.config.js
module.exports = {
plugins: [
[
"docusaurus-plugin-generate-llms-txt",
{
outputFile: "llms.txt", // defaults to llms.txt if not specified
},
],
// other plugins...
],
};
The plugin will generate the llms.txt file in the following scenarios:
- When running
yarn start
(development mode) - When running
yarn build
(production build)
You can also manually generate the file by running:
yarn docusaurus generate-llms-txt
Configuration Options
| Option | Type | Default | Description |
| ------------ | -------- | ------------ | --------------------------- |
| outputFile
| string
| 'llms.txt'
| The name of the output file |
Documentation Structure
⚠️ Note: This plugin makes some assumptions about the structure of your docs:
- The
docs
directory contains your documentation - Each category has a
_category_.yml
file that contains the category metadata - Each page has frontmatter metadata
- For top-level Markdown pages, there is a
sidebar_position
field in the metadata
Example structure:
docs/
├── my-first-category/
│ ├── _category_.yml
│ ├── ...
│ ├── some-sub-page.md
├── my-second-category/
│ ├── _category_.yml
│ ├── ...
│ ├── some-sub-page.md
├── some-top-level-page.md
└── ...
Development
To test the plugin locally:
- Clone the repository
- Install dependencies:
yarn install
- Run tests:
yarn test
- Link the package:
yarn link
- In your Docusaurus project:
yarn link docusaurus-plugin-generate-llms-txt
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to:
- Open issues for bug reports or feature requests
- Submit pull requests
- Improve documentation
- Share feedback
Before contributing, please:
- Check existing issues and PRs
- For major changes, open an issue first
- Add tests for new features
- Ensure tests pass:
yarn test