AI-Ready Documentation #
Documentation is read in browsers, but it is also used by coding assistants, knowledge bases, and other AI tools.
KawaPress generates a Markdown representation alongside each web page. This feature is already enabled when you use the default nagi preset, so no extra installation or configuration is required.
Copy the Current Page #
Every regular documentation page includes a Markdown action below its level-one heading.
The main button fetches and copies the Markdown for the current page. Open the adjacent menu to copy the full URL of that Markdown file instead.
The copied URL uses the origin of the website the reader is visiting and the configured base. For example, when a reader opens:
https://docs.example.com/kawapress/guide/startKawaPress copies this Markdown URL:
https://docs.example.com/kawapress/guide/start.mdThe Markdown body is fetched only when requested. It is not included in the browser JavaScript bundle.
Generated Files #
After kawapress build, every page has a corresponding .md file.
The development server provides the same URLs. You can open them while writing to inspect exactly what an AI tool receives.
llms.txt and llms-full.txt #
KawaPress also creates two entry files for every locale.
llms.txtis a concise documentation index with page titles, Markdown links, and page descriptions.llms-full.txtcombines every page in that locale for tools that need the complete documentation in one response.
The default locale uses:
/llms.txt
/llms-full.txtOther locales use their own directories:
/en/llms.txt
/en/llms-full.txtEach index contains only pages from its own locale.
llms.txt follows the sidebar. Each sidebar group becomes a second-level heading, with its pages in sidebar order, so an AI tool can tell getting-started pages from reference pages at a glance. A page the sidebar does not list but that sits under a listed page's folder comes right after that page, such as the API pages under a module page. Any other page goes under a final "Other" heading.
# KawaPress
> A Vite & Vue powered static site generator.
## Introduction
- [Getting Started](/en/guide/getting-started.md): Install KawaPress and create, run, and build your first documentation site.
## Reference
- [kawapress](/en/api/kawapress.md): The core of KawaPress: site config, plugin API…
- [defineConfig](/en/api/kawapress/defineConfig.md): …
## Full text
- [All documentation](/en/llms-full.txt): 196 pages
- [Introduction / Writing](/en/guide/llms-full.txt): 13 pages
- [Themes & Plugins / Official Plugins](/en/plugins/llms-full.txt): 18 pages
- [Reference](/en/api/llms-full.txt): 162 pagesThe final "Full text" heading lists the full-text files. Besides the llms-full.txt of the whole locale, every top-level folder gets one with only its own pages, such as /guide/llms-full.txt or /en/api/llms-full.txt. A tool that needs one part of the documentation can read just that file instead of the whole site.
Use the Plugin Independently #
nagi already includes this feature. A site that does not use nagi can install and configure the same plugin directly:
npm install --save-dev @kawapress/plugin-llmspnpm add --save-dev @kawapress/plugin-llmsyarn add --dev @kawapress/plugin-llmsimport llmsPlugin from '@kawapress/plugin-llms'
import { defineConfig } from 'kawapress'
export default defineConfig({
plugins: [
llmsPlugin(),
],
})The Generator Plugin creates the Markdown files. Its matching Runtime Plugin automatically adds the copy interface and styles, so the runtime entry does not need to be imported manually.
On its own, the plugin does not know your sidebar, so llms.txt lists every page under one ## Docs heading. Pass sections() to group them:
import llmsPlugin from '@kawapress/plugin-llms'
import { defineConfig } from 'kawapress'
export default defineConfig({
plugins: [
llmsPlugin({
sections: ({ locale }) => locale === 'root'
? [
{ title: 'Guide', links: ['/guide/getting-started', '/guide/routing'] },
{ title: 'Reference', links: ['/reference/'] },
]
: undefined,
}),
],
})It runs once per locale. links are page route paths written like sidebar links, without the site base. nagi passes a sections() that reads its own sidebar, so a nagi site does not need one.
Add a Site Description #
Set llms: false in nagi() to leave out both the llms files and the page actions above the document.
The site summary at the top of llms.txt is the description from the site config, the same sentence as the page description meta. A multilingual site gives each language its own description:
import { nagi } from 'kawapress/nagi'
export default nagi({
description: 'KawaPress English documentation.',
locales: {
root: { label: 'English', lang: 'en' },
zh: { label: '简体中文', lang: 'zh-CN', description: 'KawaPress 中文文档。' },
},
})Use llmsTxt() when the index needs complete customization:
import { nagi } from 'kawapress/nagi'
export default nagi({
llms: {
llmsTxt({ defaultContent, locale }) {
return `${defaultContent}\n<!-- locale: ${locale} -->`
},
},
})The callback runs once for each locale. defaultContent is the complete default index generated by KawaPress, so it can be returned unchanged or extended.
Describe a Page #
A page's description becomes its summary in llms.txt:
---
description: Install the dependencies and create your first KawaPress site.
---
# Getting StartedUse llmsTxt when the web page and AI index need different summaries:
---
description: Create and run your first site.
llmsTxt: Install KawaPress, start the development server, and generate static files.
---
# Getting StartedExclude a page from the Markdown output and indexes with:
---
llms: false
---This is useful for pages that exist only for website interaction and do not make sense as standalone reading.
Vue Content Is Rendered Too #
Vue expressions, components, and <script setup> in Markdown run in a dedicated server environment. Regular Markdown keeps its source shape, while dynamic Vue content uses its rendered result.
For example:
<script setup lang="ts">
const total = 2 + 2
</script>
# Result
The final result is **{{ total }}**.The generated Markdown contains:
# Result
The final result is **4**.Root-level <script>, <script setup>, and <style> blocks still take part in rendering, but they are not included in the final body.
Automatic conversion may have limitations
KawaPress can read only the content a component renders on the server. It cannot infer the meaning behind an interaction. Content that appears only in the browser, is drawn on a Canvas, or requires user interaction does not automatically become complete Markdown.
For tabs, diagrams, and interactive demos, open the corresponding .md file and check the result. If the automatic output does not work as standalone reading, provide the content explicitly with SsgMarkdown as shown below. The component should also follow the SSR compatibility guidelines.
Provide Markdown for a Complex Component #
Tabs, diagrams, and interactive demos can have a clearer textual representation than their visual structure suggests. A component can provide that representation explicitly with SsgMarkdown.
First add the plugin as a direct development dependency:
npm install --save-dev @kawapress/plugin-llmspnpm add --save-dev @kawapress/plugin-llmsyarn add --dev @kawapress/plugin-llmsThen provide separate web and Markdown representations:
<script setup lang="ts">
import { SsgMarkdown } from '@kawapress/plugin-llms/client'
const isSsgMarkdown = import.meta.env.SSG_MD
const markdown = `## Install commands
- npm: \`npm install --save-dev kawapress\`
- pnpm: \`pnpm add --save-dev kawapress\`
- Yarn: \`yarn add --dev kawapress\``
</script>
<template>
<SsgMarkdown v-if="isSsgMarkdown" :content="markdown" />
<CommandTabs v-else>
<CommandTab name="npm" command="npm install --save-dev kawapress" />
<CommandTab name="pnpm" command="pnpm add --save-dev kawapress" />
<CommandTab name="Yarn" command="yarn add --dev kawapress" />
</CommandTabs>
</template>The browser keeps the interactive tabs, while the generated .md receives a concise and complete install command. The same component can therefore present the right form to both human readers and AI tools.


Comments