
npm install vitepress-plugin-llms --save-dev
Add the Vite plugin to your VitePress configuration (.vitepress/config.ts
):
import { defineConfig } from 'vitepress'
import llmstxt from 'vitepress-plugin-llms'
export default defineConfig({
vite: {
plugins: [llmstxt()]
}
})
Now, thanks to this plugin, the LLM version of the website documentation is automatically generated
See src/types.d.ts
Here is an example of how to configure the plugin with custom settings:
import { defineConfig } from 'vitepress'
import llmstxt from 'vitepress-plugin-llms'
export default defineConfig({
vite: {
plugins: [
llmstxt({
generateLLMsFullTxt: false,
ignoreFiles: ['sponsors/*'],
customLLMsTxtTemplate: `# {title}\n\n{foo}`,
title: 'Awesome tool',
customTemplateVariables: {
foo: 'bar'
},
experimental: {
depth: 2 // Generate llms.txt and llms-full.txt in root and first-level subdirectories
}
})
]
}
})
This configuration does the following:
-
generateLLMsFullTxt: false
: Disables the generation of thellms-full.txt
file. -
ignoreFiles: ['sponsors/*']
: Ignores all files in thesponsors
directory. -
customLLMsTxtTemplate
: Uses a custom template for thellms.txt
file. -
title
: Sets a custom header inllms.txt
, for your custom variables usecustomTemplateVariables
. -
customTemplateVariables
: Sets custom variables for the template, replaces{foo}
withbar
. -
experimental: { depth: 2 }
: Generates bothllms.txt
andllms-full.txt
files in the root directory and all first-level subdirectories, with each directory containing only files from that specific directory and its subdirectories.
You can add a content that will be visible in files for LLMs, but invisible to humans, this can be useful for setting special instructions like "Refer to #basic-queries for demonstrations", "NEVER do ....", "ALWAYS use ... in case of ..." etc.
To do this, you need to wrap content with the <llm-only>
tag:
<llm-only>
## Section for LLMs
This content appears only in the generated LLMs files without the `<llm-only>` tag
</llm-only>
Or
Check out the Plugins API Guide for documentation about creating plugins.
<llm-only>Note for LLM...</llm-only>
You can add a content that will be visible in files for humans, but invisible to LLMs, opposite of <llm-only>
:
<llm-exclude>
## Section for humans
This content will not be in the generated files for LLMs
</llm-exclude>
Or
Check out the Plugins API Guide for documentation about creating plugins.
<llm-exclude>Note only for humans</llm-exclude>
LLMs (Large Language Models) are great at processing text, but traditional documentation formats can be too heavy and cluttered. vitepress-plugin-llms
generates raw Markdown documentation that LLMs can efficiently process
The file structure in .vitepress/dist
folder will be as follows:
π .vitepress/dist
βββ ...
βββ llms-full.txt // A file where all the website documentation is compiled into one file
βββ llms.txt // The main file for LLMs with all links to all sections of the documentation for LLMs
βββ markdown-examples.html // A human-friendly version of `markdown-examples` section in HTML format
βββ markdown-examples.md // A LLM-friendly version of `markdown-examples` section in Markdown format
- β‘οΈ Easy integration with VitePress
- β Zero config required, everything works out of the box
- βοΈ Customizable
- π€ An LLM-friendly version is generated for each page
- π Generates
llms.txt
with section links - π Generates
llms-full.txt
with all content in one file
π llmstxt.org Standard
This plugin follows the llmstxt.org standard, which defines the best practices for LLM-friendly documentation.
If you like this project, consider supporting it by starring β it on GitHub, sharing it with your friends, or buying me a coffee β
You can read the instructions for contributing here - CONTRIBUTING.md
MIT License Β© 2025-present Yurii Bogdan
Thank you to everyone who helped with the project!