# AGENTS.md — `@itsy/html` for coding agents Tagged-template HTML renderer that returns escaped strings. ESM-only, zero deps, isomorphic, **synchronous**. Every export is documented in its `.d.ts` — read those for exact types. This file is the task-oriented map. ## Import map | import path | exports | | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `@itsy/html` | `html`, `trusted`, `attrs`, `cx`, `raw`, `Html`, `isHtml`, `HtmlError`; types `Renderable`, `AttrValue`, `AttrGroup`, `ClassValue`, `StyleValue` | | `@itsy/html/attrs` | `attrs`, `cx`, `esc` — standalone, without the template scanner | | `@itsy/html/check` | `check(markup, { ids?, a11y?, rules? })` → `(Problem \| Finding)[]` — the output validator, plus twenty-five accessibility rules that run **by default**. `a11y: false` turns them off; `a11y: { without: [...] }` turns some off by name, checked against `A11yRule`. `rules` takes custom `RuleSet`s, run in the same pass. `check.enabled` is `false` in the prod build, where `check()` returns `[]`. Types `Problem`, `Finding`, `RuleSet`, `Visitor`, `Report`, `A11yRule`, `A11yOptions`, `CheckOptions` | | `@itsy/html/frame` | `frame(options)` → the whole document; `head(parts, { nonce? })` → merged head fragment; `element(entry, nonce?)` → one element. Types `FrameOptions`, `HeadEntry`, `FramePart` | | `@itsy/html/util` | `join(items, joiner)`, `map(items, f)`, `range(end)` / `range(start, end, step)`, `when(cond, trueFn, falseFn?)`, `choose(value, cases, fallback?)`, `wrap(items, tag, attrs?)`, `comment(text)`. Opt-in, one export each, tree-shakable. All return arrays or the thunk result and render nothing, except `comment`, which returns `Html` | | `@itsy/html/create` | `createHtml({ schemes?, collapse? })` → `{ html, attrs }` with their own URL guard, whitespace rule and template cache; `SCHEMES`, the default set, to spread. Type `CreateOptions` | ## Core usage ```ts import { html, attrs, raw } from '@itsy/html'; import { join, wrap } from '@itsy/html/util'; html`${label}`; // → Html (a wrapper: `.markup` gives the string; `.render()` is the same) html`