Page by Spec
You can use the OASpec component to render all operations in any Markdown file.
Example
Markdown File
If you have configured the OpenAPI Specification using the useOpenapi composable in your .vitepress/theme/index.[js,ts] file, you can just use the OASpec component to render all operations in any Markdown file.
markdown
---
aside: false
outline: false
title: vitepress-openapi
---
<OASpec />Large Specs
OASpec renders every operation on one page. By default, the full HTML is generated at build time, so search engines see all of it, and on the client each operation only becomes interactive when it gets close to the viewport.
For specs with hundreds of operations, the page itself gets heavy (HTML size and memory). Two options:
- One page per operation or per tag (recommended): see Page by Operation and Page by Tag. Each page only renders what it needs.
lazy-rendering: render only the first operation, and the rest when the browser is idle. The other operations are not in the build HTML, so prefer separate pages if you care about SEO.
markdown
<OASpec :lazy-rendering="true" />If you only need static, searchable pages (or docs for AI agents), you can also generate plain Markdown at build time.