okineadev/vitepress-plugin-llms

📜 A VitePress plugin for generating LLM-friendly documentation

What it is

vitepress‑plugin‑llms is a VitePress plugin that automatically creates LLM‑friendly versions of your documentation at build time. It produces plain‑text Markdown files (llms.txt with section links and llms‑full.txt containing the whole site) and optional UI helpers so visitors can copy or download pages as Markdown.

Why you might want it

Large Language Models work best with clean, lightweight text. Traditional VitePress output includes HTML, navigation, and other UI‑only markup that can confuse LLMs. This plugin extracts the raw Markdown, adds optional tags (<llm‑only> / <llm‑exclude>) for fine‑grained control, and follows the llmstxt.org v2 standard, making your docs ready for downstream AI tooling (e.g., retrieval‑augmented generation, indexing, or fine‑tuning).

How to get started

npm install vitepress-plugin-llms --save-dev

Add the plugin in .vitepress/config.ts:

import { defineConfig } from 'vitepress'
import llmstxt from 'vitepress-plugin-llms'

export default defineConfig({
  vite: { plugins: [llmstxt()] },
})

Optionally register the bundled Vue component to give users “Copy as Markdown” / “Download as Markdown” buttons:

import DefaultTheme from 'vitepress/theme'
import CopyOrDownloadAsMarkdownButtons from 'vitepress-plugin-llms/vitepress-components/CopyOrDownloadAsMarkdownButtons.vue'

export default {
  extends: DefaultTheme,
  enhanceApp({ app }) { app.component('CopyOrDownloadAsMarkdownButtons', CopyOrDownloadAsMarkdownButtons) },
}

Then enable the markdown transformer:

import { copyOrDownloadAsMarkdownButtons } from 'vitepress-plugin-llms'

export default defineConfig({
  markdown: { config(md) { md.use(copyOrDownloadAsMarkdownButtons) } },
})

You can also use the composable useCopyOrDownloadAsMarkdownButtons if you prefer a custom UI.

Customising the UI text

Labels are read from themeConfig.llms (or per‑locale under locales.<locale>.themeConfig.llms). All keys are optional:

Key Default
copyText Copy page
copiedText Copied
viewMarkdownText View as Markdown
openInAIText Open in {provider}

Special markup for LLM‑only or LLM‑excluded content

  • <llm-only> – content inside this tag is included in the generated llms.txt files but hidden from human readers.
  • <llm-exclude> – content inside this tag is shown to humans but omitted from the LLM files.

Validation

After deployment you can verify that the generated llms.txt URLs still resolve with the helper tool llms‑txt‑check:

npx llms-txt-check https://your-docs-site.com

The command exits with a non‑zero code if any listed URL is broken.

Key features (at a glance)

  • ✅ Zero‑config integration with VitePress
  • ⚙️ Fully customizable via VitePress theme config
  • 🤖 Generates per‑page LLM‑friendly Markdown and two index files (llms.txt, llms‑full.txt)
  • 📋 Optional “Copy / Download as Markdown” UI component
  • 🏷️ <llm-only> / <llm-exclude> tags for fine‑grained content control
  • 📦 Built with Bun, formatted with oxc, and CI‑tested automatically

Who uses it

The README lists several high‑profile projects (Vite, Vue.js, Vitest, Rolldown) and a handful of early adopters that already expose llms.txt and llms‑full.txt on their sites.

License & contribution

MIT‑licensed. Contributions are welcomed via the linked CONTRIBUTING.md and the project accepts sponsorship through GitHub.

Related

  • Project
  • Project
  • Project
  • Project
  • Project