Skip to main content

Overview

The Legacy HTML generator produces the legacy version of the API documentation in HTML format, including all assets and styles as separate files. This generator provides retro-compatibility while newer generators are being implemented.

Metadata

name
string
default:"legacy-html"
Generator identifier
version
string
default:"1.0.0"
Generator version
dependsOn
string
default:"metadata"
Requires metadata generator output as input
hasParallelProcessor
boolean
default:"true"
Supports parallel processing for improved performance

Configuration

templatePath
string
default:"./template.html"
Path to the HTML template file
additionalPathsToCopy
array
Array of paths to copy to output (e.g., assets folder)Default:
["./assets"]
ref
string
default:"main"
Git reference (branch/tag) for source links
output
string
Output directory path for generated HTML files and assets
index
array
Optional index configuration for custom navigation ordering
minify
boolean
default:"false"
Enable HTML minification for production builds

Output Format

The generator produces:
  • HTML files: One per API module (e.g., http.html, fs.html)
  • Assets folder: Copied from additionalPathsToCopy
  • Navigation: Generated table of contents with active states

Usage

doc-kit -t legacy-html

Dependency Chain

ast → metadata → legacy-html
The legacy HTML generator depends on:
  1. ast - Parses Markdown to AST
  2. metadata - Extracts API metadata
  3. legacy-html - Renders to legacy HTML format

Implementation Details

The generator:
  • Groups nodes by module using groupNodesByModule
  • Generates navigation from heading nodes
  • Processes chunks in parallel using worker threads
  • Builds table of contents with syntax highlighting via Shiki
  • Replaces template values with generated content
  • Optionally minifies HTML output
  • Copies asset files to output directory

Parallel Processing

The processChunk function runs in worker threads:
  • Builds navigation with active class for current page
  • Generates table of contents (max depth: 4)
  • Builds content with syntax-highlighted code blocks
  • Returns template objects for file writing
Source: src/generators/legacy-html/

Build docs developers (and LLMs) love