Skip to main content

Getting Started

Installation

# npm
npm install -D @jiji-hoon96/oxdoc

# pnpm
pnpm add -D @jiji-hoon96/oxdoc

# Or run directly with npx
npx @jiji-hoon96/oxdoc --help

Requirements

  • Node.js 20 or higher
  • TypeScript/JavaScript project

Basic Usage

1. Generate API Docs

Extract JSDoc/TSDoc comments from source code and generate documentation.

# JSON format (default)
npx @jiji-hoon96/oxdoc generate ./src

# Markdown format
npx @jiji-hoon96/oxdoc generate ./src --format markdown

# HTML format (standalone single-page with sidebar, search, dark theme)
npx @jiji-hoon96/oxdoc generate ./src --format html

# Specify output directory
npx @jiji-hoon96/oxdoc generate ./src --format markdown --output ./api-docs

2. Check Documentation Coverage

Measures the ratio of exported symbols that have JSDoc documentation.

# Check coverage
npx @jiji-hoon96/oxdoc coverage ./src

# Set threshold (CI — returns exit code 1 if below)
npx @jiji-hoon96/oxdoc coverage ./src --threshold 80

# JSON output
npx @jiji-hoon96/oxdoc coverage ./src --format json

# Include non-exported symbols
npx @jiji-hoon96/oxdoc coverage ./src --all

3. Run Doc Tests

Validates that @example code blocks actually work.

npx @jiji-hoon96/oxdoc doctest ./src

# Stop on first failure
npx @jiji-hoon96/oxdoc doctest ./src --bail

Writing Doc Tests

Use // => to specify expected values, which become automatic assertions:

/**
* Adds two numbers.
* @param a - First number
* @param b - Second number
* @returns The sum
* @example
* ```ts
* add(1, 2) // => 3
* add(-1, 1) // => 0
* ```
*/
export function add(a: number, b: number): number {
return a + b;
}

Supported Symbol Types

KindExampleExtracted Data
Functionexport function foo()signature, JSDoc, overloads
Classexport class Foomethods, properties, getters/setters, static members
Interfaceexport interface IFooproperties with JSDoc
Type Aliasexport type Foo = ...signature, JSDoc
Enumexport enum Foo { A, B }members with values and JSDoc
Variableexport const FOO = ...signature, JSDoc
Namespaceexport namespace Utilsexported children
Re-exportexport { X } from './y'source module tracking
Default Exportexport default functionflagged with isDefault

Supported JSDoc Tags

@param, @returns, @example, @typeParam, @throws, @since, @deprecated, @see, and custom tags