Skip to content

A Docusaurus plugin that generates a concatenated markdown file from your documentation under /llms.txt

License

Notifications You must be signed in to change notification settings

din0s/docusaurus-plugin-llms-txt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

npm version License: MIT

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:

  1. Clone the repository
  2. Install dependencies: yarn install
  3. Run tests: yarn test
  4. Link the package: yarn link
  5. 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:

  1. Check existing issues and PRs
  2. For major changes, open an issue first
  3. Add tests for new features
  4. Ensure tests pass: yarn test

About

A Docusaurus plugin that generates a concatenated markdown file from your documentation under /llms.txt

Topics

Resources

License

Stars

Watchers

Forks