Skip to main content

Overview

The Web generator transforms JSX AST entries into complete web bundles with server-side rendered HTML pages, client-side JavaScript with code splitting, and bundled CSS styles.
This generator does NOT support streaming/chunked processing because processJSXEntries needs all entries together to generate code-split bundles.

Metadata

name
string
default:"web"
Generator identifier
version
string
default:"1.0.0"
Generator version
dependsOn
string
default:"jsx-ast"
Requires JSX AST generator output as input

Configuration

templatePath
string
default:"./template.html"
Path to the HTML template file used for rendering pages
title
string
default:"Node.js"
Page title used in generated HTML documents
imports
object
Custom import mappings for componentsDefault:
{
  "#config/Logo": "@node-core/ui-components/Common/NodejsLogo"
}
output
string
Output directory path for generated files (HTML, CSS, JS)

Output Format

The generator produces:
  • HTML files: Server-side rendered pages (e.g., http.html, fs.html)
  • JavaScript chunks: Code-split bundles for client-side hydration
  • CSS bundle: Single styles.css file containing all styles

Usage

doc-kit -t web

Dependency Chain

ast → metadata → jsx-ast → web
The web generator depends on:
  1. ast - Parses Markdown to AST
  2. metadata - Extracts API metadata
  3. jsx-ast - Converts to JSX components
  4. web - Renders to HTML/CSS/JS bundles

Implementation Details

The generator:
  • Reads an HTML template from templatePath
  • Creates AST builders for server and client programs
  • Processes JSX entries through processJSXEntries to convert to HTML/CSS/JS
  • Writes all output files to the configured output directory
  • Returns an array of HTML strings with associated CSS
Source: src/generators/web/

Build docs developers (and LLMs) love