A TypeDoc plugin that generates llms.txt files for LLM consumption.
llms.txt is a convention for providing LLM-friendly documentation summaries. This plugin automatically generates an llms.txt file from your TypeDoc documentation.
npm install typedoc-plugin-llms-txt typedoc -D
typedocv0.28.0 or later is a required peer dependency.
Add the plugin to your TypeDoc configuration:
// typedoc.config.js
export default {
plugin: ['typedoc-plugin-llms-txt'],
// ... other options
};That's it! The plugin will generate an llms.txt file in your output directory with reasonable defaults.
The plugin works out of the box with sensible defaults:
- Project name: From TypeDoc's
nameoption - Description: From your
package.jsondescription - Sections: Auto-discovered from
projectDocumentsfrontmatter categories - API links: Auto-generated from TypeDoc entry points
Customize the output with these TypeDoc options:
Enable or disable llms.txt generation. Default: true
Output filename. Default: "llms.txt"
Customize the header section:
{
llmsTxtHeader: {
name: 'My Project', // defaults to TypeDoc name
description: 'A cool library', // defaults to package.json description
features: [ // defaults to empty
'Feature one',
'Feature two',
],
},
}Control how document categories are displayed and ordered:
{
llmsTxtSections: {
Guides: { displayName: 'Documentation', order: 1 },
Reference: { displayName: 'Reference', order: 2 },
About: { displayName: 'Optional', order: 3 },
},
}Categories not listed use their original name and appear alphabetically after configured sections.
Add links to specific API symbols using TypeDoc declaration references:
{
llmsTxtDeclarations: [
{ ref: 'myproject!', label: 'API Reference', description: 'Full API docs' },
{ ref: 'myproject!myFunction', label: 'myFunction()' },
],
}Add a code examples section:
{
llmsTxtQuickReference: `
// Basic usage
import { foo } from 'myproject';
foo();
`,
}Use a custom template file for full layout control:
{
llmsTxtTemplate: './llms-template.md',
}Template slots:
{{header}}- Name, description, and features{{sections}}- All document sections{{section:CategoryName}}- Specific category{{declarations}}- API links{{quickReference}}- Code examples