vitepress-plugin-llms

A zero-config VitePress plugin that generates llms.txt and llms-full.txt so LLMs can consume your docs as clean Markdown.

Tool
npm
v1.13.5
387stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
75/100Good
Development Activity84
Maintenance88
Community48
Maturity40
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
86/100Excellent
Architecture82
Code Quality85
Innovation90
Learning Curve88

vitepress-plugin-llms is a Vite plugin for VitePress sites that automatically produces LLM-friendly documentation alongside your normal HTML output. During the build it walks every Markdown page, strips VitePress-specific markup, and writes both a per-page Markdown twin and two aggregate files — llms.txt (a linked index of sections, following the llmstxt.org standard) and llms-full.txt (the entire site concatenated into one document) — so that language models can ingest a site’s documentation efficiently without parsing HTML.

Beyond the core generation pipeline, the plugin ships optional extras for human readers too: a bundled Vue component (and a headless composable for custom UIs) that adds “Copy as Markdown” and “Download as Markdown” buttons to each page, plus custom <llm-only> and <llm-exclude> markdown tags for writing content that’s visible to either humans or LLMs but not both. It requires no configuration to get useful output and is already used in production by projects including Vite, Vue.js, Vitest, and Rolldown.

What You Get

  • Automatic generation of llms.txt — a linked table of contents of the whole site following the llmstxt.org standard
  • Automatic generation of llms-full.txt — the entire site’s documentation concatenated into a single Markdown file
  • A Markdown-format twin (page.md) generated alongside every HTML page for direct LLM consumption
  • Optional CopyOrDownloadAsMarkdownButtons Vue component (and a headless composable) for one-click copy/download of any page as Markdown
  • Custom <llm-only> / <llm-exclude> markdown tags to target content specifically at LLMs or specifically at human readers
  • Configurable exclusion of blog pages, the index page, and team pages, plus custom ignore-file globs and a customizable llms.txt template

Common Use Cases

  • Publishing a VitePress-based docs site (library, framework, API reference) that AI coding assistants and chatbots can cite accurately
  • Letting users paste an entire project’s documentation into an LLM context window via a single llms-full.txt download
  • Adding one-click ‘Copy as Markdown’ buttons so developers can quickly hand a doc page to ChatGPT/Claude for help
  • Writing LLM-only guidance (e.g. ‘always use X API in case of Y’) into docs without cluttering the page humans see

Under The Hood

Architecture — The plugin’s llmstxt() factory (src/plugin/plugin.ts) returns a tuple of two Vite plugins. A pre-enforce plugin’s transform() hook (delegated to src/plugin/hooks.ts) runs on every Markdown file, parses frontmatter with gray-matter, and accumulates content into a mdFiles Map while capturing the parsed index.md separately. A post-enforce plugin resolves the VitePress config in configResolved, wires up a dev-server middleware (src/plugin/dev-server.ts) so llms.txt and per-page Markdown are servable during vitepress dev, and on Rollup’s generateBundle hook (skipped during the SSR build) invokes the generator pipeline to write llms.txt (src/generator/llms-txt.ts), llms-full.txt (src/generator/llms-full-txt.ts), individual page files (src/generator/page-generator.ts), and a table of contents (src/generator/toc.ts).

Tech Stack — Written in TypeScript (96% of the codebase) with a small Vue component (3.5%) for the copy/download buttons, bundled with bunup (a Bun-based bundler) and shipped as dual-path ESM (., ./vitepress-components, ./vitepress-components/*.vue in package.json exports). Markdown/AST processing runs on remark, remark-frontmatter, mdast-util-from-markdown, unist-util-visit, and unist-util-remove, with a patched mdast-util-to-markdown applied via Bun’s patchedDependencies. The markdown-it plugin powers the inline copy-buttons markup, minimatch handles ignore-file globs, and millify/pretty-bytes format human-readable build stats. Dev tooling leans on the Oxc toolchain (oxlint, oxfmt), bun test, Husky + nano-staged pre-commit hooks, commitlint, cspell, and Renovate for automated dependency bumps.

Code Quality — Tests under tests/ mirror the src/ layout (generator, markdown/remark-plugins, plugin, utils) and include snapshot tests for llms.txt, llms-full.txt, table-of-contents output, and plugin behavior, backed by mocked filesystem and logger fixtures. TypeScript config extends @tsconfig/strictest, and linting is enforced with oxlint plus eslint-plugin-perfectionist for consistent ordering. The project has a high commit cadence (452 commits, 63 tagged releases, ~6.3 commits/month) and enforces conventional commits via commitlint — no untested core modules were found during exploration.

API Design — Default usage requires zero configuration: dropping llmstxt() into a VitePress site’s vite.plugins array is enough to get full llms.txt/llms-full.txt output. The LlmstxtSettings options object uses clearly named boolean toggles (generateLLMsTxt, generateLLMsFullTxt, excludeBlog, stripHTML, etc.) with sensible defaults merged explicitly at runtime. Three integration depths are offered for the copy/download feature — a plug-and-play Vue component, a headless composable for custom UI, and a raw markdown-it plugin — and the custom <llm-only>/<llm-exclude> tags are documented with clear before/after markdown examples, keeping the barrier to a working setup very low.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search