# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Project Overview Go library for rendering data tables as PNG images. Provides two APIs: - `DrawTableWarm()` — renders a single table with header and rows - `RenderDocument()` — renders a multi-block document with titled table sections ## Build & Test Commands ```bash go test ./... # run all tests go test -run TestDrawTable # run single test go test -run TestDocument # run document rendering test ``` Tests output PNG files to `test-data/` (gitignored). Verify rendering by inspecting the generated images visually. ## Architecture - **`image_table.go`** — Core rendering engine. `DrawTableWarm()` draws a single table image. Contains font initialization (`init()`), text measurement/drawing utilities, rounded rect helper, and row-to-string conversion via reflection. Embeds `assets/jb.ttf` (JetBrains font) at compile time. - **`document.go`** — `RenderDocument()` composes multiple `TableBlock`s into a single document image with titles, using a larger font face for block headings. - **`table_block.go`** — `TableBlock` struct: a titled table with header and rows. - **`tablle_block_style.go`** — `TableBlockStyle` implements `ITableRow` to allow per-row background colors. - **`itablerow.go`** — `ITableRow` interface for custom row rendering (cells + background color). ## Key Patterns - Rows accept `any` type: slices, structs (via reflection), or `ITableRow` implementors for custom styling. - Column widths are auto-calculated from content measurement. - Two `init()` functions parse the embedded TTF font at different sizes (10pt for table cells, 12pt for document titles). - Comments and identifiers are in Russian.