DocGen
Documentation that rebuilds with the board. Write Markdown, reference the board with image
directives, and typecad-pcb doc renders layer plots, 3D views, drill maps, and the
stackup straight from the .kicad_pcb into one HTML file.
doc
Renders a Markdown file against a board file. Standard Markdown plus GitHub alerts, task lists, code highlighting, and math all work — the image directives are the pcb addition.
Example first
terminal
typecad-pcb doc ./board-docs.md ./build/typecad_concepts.kicad_pcb| Flag | Meaning |
|---|---|
| -o, --output <file> | HTML destination (default: the markdown file with an .html extension) |
| -v, --verbose | Chatty output |
| -q, --quiet | Errors only |
| --no-open | Don't open the result in the browser |
Image directives
An image whose alt text is a brace directive becomes a live render of the board:
board-docs.md
## Layers

## 3D render

## Fabrication

| Directive | Render |
|---|---|
| {F.Cu,B.Cu} | KiCAD layer plot — comma-separated layer list, any copper or technical layers |
| {Render/top/x/y/z} | 3D render — side (top/bottom/...) plus rotation angles |
| {Drill} | Drill map |
| {Stackup} | Layer stackup diagram |
| =600 / =50% | Sizing suffix on any image — pixels or percent width |
Frontmatter
frontmatter
---
title: Solar Charger
company: typeCAD
board_name: solar_charger
variant: rev-b
revision: 1.2
---
# Solar Charger
Design notes, test results, and the layer renders below.| Key | Purpose |
|---|---|
| title / company / board_name / variant / revision | Header facts rendered onto the document |
| filename | Overrides the displayed board filename |
| date | ISO date — defaults to today |
| highlight | Shiki highlight theme for code blocks (default github-light) |
| kicad_theme | Theme for KiCAD layer renders (default KiCAD Default) |
| stylesheet | Extra CSS for the output |
| dark_mode | Dark document styling (default false) |
generateDocumentation
The renderer from code — for docs pipelines and CI.
Example first
docgen.ts
import { generateDocumentation } from '@typecad/pcb/docgen';
await generateDocumentation(
'./board-docs.md',
'./build/solar_charger.kicad_pcb',
'./board-docs.html',
{ quiet: true },
);