Skip to content

API Reference ​

Lib Exports (@xtwis/ohdoc) ​

defineOhDocConfig(config) ​

Identity helper for ohdoc.config.mts. Returns its argument unchanged so the type stays narrow.

ts
import { defineOhDocConfig } from "@xtwis/ohdoc"

export default defineOhDocConfig({ title: "Docs" })

buildVitepressConfig(userConfig) ​

Merges the user config with the ohdoc defaults and vitepress-sidebar per-locale options. Called by the auto-generated .vitepress/config.mts. You do not invoke this directly.

OhDocUserConfig ​

TypeScript shape for the user config:

ts
interface OhDocUserConfig {
  src?: string
  title?: string
  repo?: string
}

Theme Entry (@xtwis/ohdoc/theme) ​

VITEPRESS_THEME ​

VitePress Theme extending the default theme with an auto Mermaid renderer that follows the dark/light mode toggle.

ts
// .vitepress/theme/index.ts (auto-generated by ohdoc init)
export { VITEPRESS_THEME as default } from "@xtwis/ohdoc/theme"

To replace, edit .vitepress/theme/index.ts after ohdoc init.

CLI ​

ohdoc init ​

Scaffolds .vitepress/{config.mts, theme/index.ts}, ohdoc.config.mts, and appends .gitignore. Idempotent — existing files are not overwritten.

ohdoc dev ​

Starts the VitePress dev server at http://localhost:5173.

ohdoc build ​

Builds the static site to .vitepress/dist/.

ohdoc preview ​

Serves the production build for a local preview.