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.

command

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
FlagMeaning
-o, --output <file>HTML destination (default: the markdown file with an .html extension)
-v, --verboseChatty output
-q, --quietErrors only
--no-openDon'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

![{F.Cu,B.Cu}](images/copper.png =600)

## 3D render

![{Render/top/0/0/0}](images/render.png =400)

## Fabrication

![{Drill}](images/drill.png)
![{Stackup}](images/stackup.svg)
DirectiveRender
{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.
KeyPurpose
title / company / board_name / variant / revisionHeader facts rendered onto the document
filenameOverrides the displayed board filename
dateISO date — defaults to today
highlightShiki highlight theme for code blocks (default github-light)
kicad_themeTheme for KiCAD layer renders (default KiCAD Default)
stylesheetExtra CSS for the output
dark_modeDark document styling (default false)
function

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 },
);
© 2026 typeCAD — code-defined electronics github