Enable JSDoc API Reference for VitePress.
This repository uses the VitePress integration to generate and serve its own API reference docs. The generated API reference site is published at https://kazupon.github.io/vitepress-api-references/. See docs/.vitepress/config.ts and the generated docs/api directory for a working self-hosted example.
import { defineConfig } from 'vitepress'
import { withOxContentApiDocs } from 'vitepress-api-references'
export default defineConfig(
await withOxContentApiDocs({
themeConfig: {
sidebar: [{ text: 'Guide', link: '/' }, { text: 'API References' }]
},
apiDocs: {
entryPoints: [{ path: 'src/index.ts' }],
outDir: 'docs/api',
basePath: '/api',
markdown: {
pathStrategy: 'typedoc',
singleEntryRoot: 'flatten',
renderStyle: 'markdown',
indexFormat: 'table'
},
nav: {
section: { text: 'API References' },
collapsed: true,
insert: 'replace',
replaceText: 'API References'
}
}
})
)Use generateOxContentApiDocs when you want to generate markdown files directly without wiring the result into VitePress. See standalone/generate.ts for a runnable example.
import { generateOxContentApiDocs } from 'vitepress-api-references'
const result = await generateOxContentApiDocs({
entryPoints: [{ path: 'src/index.ts', name: 'main' }],
outDir: 'standalone',
basePath: '/standalone',
markdown: {
pathStrategy: 'typedoc',
renderStyle: 'markdown',
indexFormat: 'table'
}
})
console.log(`Generated ${result.generatedFiles.length} files`)Run the example with:
vp run docs:standaloneThis repository uses its own public root API as the docs source under docs/.
vp run docs:build
vp run docs:devBuilt on top of Ox Content, which extracts JSDoc API metadata and renders the generated markdown.