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:

Text
https://docs.example.com/kawapress/guide/start

KawaPress copies this Markdown URL:

Text
https://docs.example.com/kawapress/guide/start.md

The 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.

PageMarkdown file
//index.md
/guide/start/guide/start.md
/en/en/index.md
/en/guide/start/en/guide/start.md

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.txt is a concise documentation index with page titles, Markdown links, and page descriptions.
  • llms-full.txt combines every page in that locale for tools that need the complete documentation in one response.

The default locale uses:

Text
/llms.txt
/llms-full.txt

Other locales use their own directories:

Text
/en/llms.txt
/en/llms-full.txt

Each index contains only pages from its own locale.

Use the Plugin Independently #

nagi already includes this feature. A site that does not use nagi can install and configure the same plugin directly:

Shell
npm install --save-dev @kawapress/plugin-llms
TypeScript
import 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.

Add a Site Description #

Use llms.description in the nagi configuration to add a site description. A multilingual site can provide one value per locale:

TypeScript
import { nagi } from 'kawapress/nagi'

export default nagi({
  llms: {
    description: {
      root: 'KawaPress Chinese documentation.',
      en: 'KawaPress English documentation.',
    },
  },
})

Use llmsTxt() when the index needs complete customization:

TypeScript
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:

Markdown
---
description: Install the dependencies and create your first KawaPress site.
---

# Getting Started

Use llmsTxt when the web page and AI index need different summaries:

Markdown
---
description: Create and run your first site.
llmsTxt: Install KawaPress, start the development server, and generate static files.
---

# Getting Started

Exclude a page from the Markdown output and indexes with:

Markdown
---
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:

Markdown
<script setup lang="ts">
const total = 2 + 2
</script>

# Result

The final result is **{{ total }}**.

The generated Markdown contains:

Markdown
# 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:

Shell
npm install --save-dev @kawapress/plugin-llms

Then provide separate web and Markdown representations:

Vue
<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.