Reference

Reference Everything an author needs in one page — project setup, page anatomy, every primitive with its JSON shape and a live example, per-page metadata, build outputs. Project setup, page shape, every primitive with JSON shape + live example, metadata, build outputs. Reference > [!TLDR] > Set up a project once, then write JSON pages. Every page is a tree of kind-tagged blocks; this page documents the kinds (inline, prose, emphasis, layout, visual), how to thread them together, per-page metadata, and the build outputs. > > - Setup · oku init creates _oku symlink + an index.html stub. One-time per project. > - Page · kind:"page" → title + meta + blocks; blocks are sections (which contain content blocks) or top-level tldr / kpi-grid. > - Inline · glossary-term, ext-ref, code, em, strong, link > - Prose · paragraph, heading, list, code, annotated-code > - Emphasis · callout, insight, info-tip > - Layout · tldr, kpi-grid, table, compare-grid, step-flow > - Visual · chart (scatter / line / area / bubble / quadrant / bar / stacked-bar / grouped-bar / donut), diagram, live-snippet > - Build · oku build → dist/standalone/ (single files) and dist/site/ (+ manifest, llms.txt, Pagefind) ## Project setup {#setup} One-time per project. Links the kit so pages can reference _oku/chrome.js and friends without copying anything. ```bash cd path/to/your-project/docs oku init # creates _oku symlink + index.html in cwd # Optional: drop a starter page into the docs root # (The starter pair ships inside the html_doc package — for a # git checkout it lives at src/html_doc/templates/starter.json.) cd .. oku serve # http://localhost:9876 with live reload ``` After init, your project has a `docs/_oku/` symlink pointing at the kit repo. Every page references the kit via ` ` and ` ` — no copies, no version drift. Update the kit in one place and every project picks it up. > [!NEUTRAL] kit.json — declare your project > Each project's docs/kit.json picks which glossary domains to activate, the preferred language, and any project-local glossary or ext-ref overrides. The kit ships starter domains (data-platforms, web, ai-llm) — pick whichever fit. The glossary page covers domain selection in detail. ## Anatomy of a page {#anatomy} A page is one markdown file: YAML front-matter, then a GFM body. There is nothing else to keep in step — no wrapper, no build step for the content, no second copy of the page in another format. GitHub renders the same file as ordinary markdown; the kit renders it with the chrome. ````markdown --- title: My note summary: One line describing the page. order: 10 --- > [!TLDR] > What a reader who stops here should leave with. ## Overview {#overview} Plain prose, with *emphasis*, `code` and a [link](other.md). *An italic line right after a figure is its caption.* ```` Three things in that file are the whole format: - **Front-matter is metadata, never content.** `title` is required; `summary` is the one other field worth writing on most pages. [Per-page metadata](#metadata) has the rest, and `oku spec front-matter` prints the list the code itself reads. - **`##` opens a section**, and `{#id}` pins its anchor. Left off, the id is slugged from the title — fine until the title changes or the page is translated, because `slugify` strips non-ASCII and a translated heading has to carry its original's id verbatim. - **A primitive is a typed fence** whose body is one compact JSON object. `oku spec` lists them; plain `mermaid` works too, and GitHub draws that one natively. > [!TIP] Why summary matters > `summary` is surfaced in four places: the page-nav tooltip on hover, the llms.txt sitemap line for AI consumers, the Pagefind search excerpt, and the cover subtitle. Keep it one tight sentence focused on what the page contains — not a teaser. ### Older pages: JSON {#json-pages} A page written before the markdown format keeps rendering, indefinitely and without a flag: v2 (`k` / `t` / `m` / `b`) natively, v1 (`kind` / `title` / `blocks`) through an in-memory shim. `oku migrate ` converts one to a `.md` source when you want it converted — deterministic, and it removes the `.json` it replaced. New pages are markdown; the JSON path is for what already exists. ### Existing markdown drops in {#markdown-sources} Existing `.md` files anywhere under the docs root are first-class pages — they appear in the site tree, render with the kit's TOC + chrome, and survive `oku check / build / serve` alongside JSON pages. You don't have to convert anything before adopting the kit; existing Markdown documentation drops in unchanged. #### Markdown → kit conversion Every Markdown construct maps to a specific kit block or inline node. The table is the source of truth — same row order the converter walks the parse tree. YAML front-matter (`--- ... ---`) `page.title` + `page.meta` ATX heading H1 `page.title` ATX heading H2 `section` (id auto-slugged from title) ATX heading H3 / H4 `heading` block inside the active section Paragraph with `**bold**` / `*italic*` / `~~strike~~` / `` `code` `` / `[text](url "title")` / `![alt](src)` / ` ` `paragraph` + inline nodes Backslash escape (`\*`, `\[`, `` \` ``) the literal character — emphasis does not fire Character reference (`&`, `—`, `→`) the decoded character Hard line break (two trailing spaces, or a trailing `\`) ` ` inside the paragraph Reference-style links `[text][label]` + `[label]: url` link inline node Footnotes `[^id]` + `[^id]: …` Numbered superscript + a 'Footnotes' section Definition list (`term\n: definition`) ` ` via html-inline Inline HTML allowlist (`a, code, em, strong, span, sup, sub, br, mark, kbd, samp, del, ins, abbr`) html-inline pass-through Fenced code block (` ```lang `) `code` (language preserved) Fenced `mermaid` block `diagram` (rendered via the kit's diagram primitive) Unordered + ordered lists, nested `list` (with html-inline children) Blockquote (`>`) ` `; a GFM alert (`> [!NOTE]`, `[!TIP]`, `[!WARNING]`, `[!CAUTION]`, `[!IMPORTANT]`, plus the kit's `[!TLDR]`) becomes a `callout` of that type GFM pipe table `table` Thematic break (`---`, `***`, `___`) ` ` > [!INFO] Relative .md links rewrite to .html > `[overview](other.md#section)` in a Markdown page becomes `other.html#section` at render time, so links between .md pages work the same as between .json pages. Absolute URLs (http, https, mailto), fragment-only refs (`#section`), and absolute paths (`/x`) pass through unchanged. ### Markdown viewer {#markdown-viewer} A link that still says `.md` when the reader clicks it opens in the kit's read-only viewer instead of handing them to the browser's plain-text rendering of the file. Try it Open this page's own Markdown source . The link is written inside an HTML island, which is why it reaches you still saying .md — a relative link in prose would have been rewritten to reference.html and taken you to the page you are already on. The viewer opens over the page, which never navigates, and fills the window. It carries the file's full path — one click copies it — the front-matter `title` and `summary`, the rendered document, and a **Source** pane holding the exact bytes with a copy button. **Open file** opens it in a new tab: as its built page when the file is a page of this tree, as the file itself otherwise. **Open in editor** hands the file to VS Code, IntelliJ IDEA or Zed through the URL scheme each one registers when installed. Nothing picks the editor for you: the first time it is a list, and the editor you pick becomes a one-click button. It appears only where the file's full path is known (a standalone page inside its build tree, or `oku serve` on loopback), because only there is the file on your own disk. IntelliJ is listed on macOS only, the one platform where its `idea://` link opens a file, and VS Code asks before opening a local path until you allow it. A file opened from inside a viewed file opens on top of it, with the trail in the bar: the back button (or Alt+Left) returns to the file before, with its place kept, and a name in the trail jumps to it. A `.md` link inside a viewed file is read from that file's place, as a browser would: a page of this tree opens as that page, any other file opens on top in the viewer. Escape, the backdrop and the close button dismiss the whole trail. Which links reach it follows from the rewrite above. A *relative* link written in prose becomes `.html`, because that file is a page in this tree and the whole page beats a file viewer. What the rewrite deliberately leaves alone is what the viewer gets: `[plan](notes/plan.md)` in prose `notes/plan.html` the rendered page `[plan](/notes/plan.md)` in prose `/notes/plan.md` the viewer ` ` in an island `notes/plan.md` the viewer `[spec](https://example.com/s.md)` unchanged the other site, in a new tab A plain left-click only. Cmd / Ctrl / Shift / middle-click, a `target`, and `download` all mean *give me the file, not your reading of it*, and keep the browser's behaviour. **The viewer renders a document; it does not run one.** A ` `, an `on*` handler, a `javascript:` destination, a framing element (`iframe`, `object`, `embed`) and a ` ` are removed before the file reaches the page, and the viewer says how many went — Source still holds every byte. A ` ` is kept and confined: it is wrapped in one CSS nesting block keyed to the viewer, so the document keeps its own styling and a rule naming `body`, `html` or `:root` reaches nothing — those three are the page the reader is on, and `body { display: none }` in a linked file used to blank it with no control left to undo it. An HTML island in a *page* is unaffected and keeps full capability: the author wrote it into their own page. A linked file is a different thing, and the difference is who reviewed it. Diagrams, charts and live snippets draw as they always do, because their payloads travel in `text/x-mermaid`, `text/x-code` and `application/json` holders, which are data. An author who wants a live island in a document makes that document a page. The three ways a page is published reach the file differently, and the reader cannot tell which one ran: `oku serve` fetched from the dev server `dist/site/` fetched — the build copies each `.md` source next to its `.html` `dist/standalone/` over `file://` read from a map inlined into the HTML at build time The `file://` case is why the build is involved at all: a page on a `file://` origin cannot read the file sitting next to it, so `oku build` inlines every `.md` its pages link to, keyed by the href as authored. A link the build could not resolve — missing, outside the tree, or over 512K — is reported at build time rather than failing in front of a reader. > [!NEUTRAL] Every Markdown file is a page by default > README.md, CHANGELOG.md, CLAUDE.md, AGENTS.md, LICENSE.md, CONTRIBUTING.md, CODE_OF_CONDUCT.md, SECURITY.md and any other `.md` the walker reaches all surface as pages. Hide one by moving it under a SKIP_DIRS subdirectory (`dist/`, `_oku/`, `.git/`, `.venv/`, `node_modules/`, `templates/`, `_internal/`). ## Prose primitives {#prose} paragraph, heading, list, code — the four building blocks of any prose section. Used together they cover ~80% of typical content. ### paragraph {#paragraph} ### heading {#heading} Sub-headings inside a section. `level` is 3 or 4 (h1 = page title, h2 = section title — both produced automatically). Optional `id` for permalinks; auto-slugified if absent. ### list {#list} ### code {#code} Code blocks. `language` is informational; the renderer puts a `language-*` class on the inner ` ` so Prism (loaded lazily from CDN) highlights on demand. The runtime then adds a gray gutter with line numbers and — for brace languages — a click target on each foldable region's opening line. ### annotated-code {#annotated-code} Numbered code annotations. Markers like `(1)` / `(2)` inside the source become circular accent chips, paired with a numbered side panel. Hovering a chip drops a tooltip BELOW the line (never blocking the code) and highlights the line it points at. Click to jump between chip and panel item. Each annotation can also declare `lines` (a 1-based line spec — `"3"`, `"1-3"`, `"1,5-7"`) to mark a range or set, and / or `match` (string or array) to highlight specific substrings on hover. When `lines` is set and no inline `(N)` marker is present, the chip auto-places at the start of the first listed line — the source stays clean. ## Emphasis primitives {#emphasis} callout, insight, info-tip — three ways to highlight content with different weight. Match weight to reader signal. ### callout {#callout} Block-level themed note. `type` picks the colour band: `warn` / `warning` / `caution` (amber), `danger` (red), `success` / `tip` (green), `info` / `note` (accent blue), `neutral` (gray, default). Optional `title`. `content` is richString. Optional `bind` pairs this callout with another block of the same bind key — hovering one flashes the other (see Cross-cutting › Synced hover pairs). ### insight {#insight} A pull-quote for a key takeaway. Larger and more visually distinct than a paragraph — used to mark the one sentence per section worth slowing down for. ### info-tip {#info-tip} Native ` ` in disguise — collapsed by default, expand on click. Use to defer optional depth without disrupting the skim path. `content` is an array of the same things a page body holds: markdown strings for prose, typed blocks for anything else. ## Structured-layout primitives {#layout} tldr, kpi-grid, compare-grid, step-flow — when prose isn't the right shape. ### tldr {#tldr} Top-level only. Highlighted opener box with optional `title`, a `summary` line, and `bullets` — each bullet is rich-text. ### kpi-grid {#kpi-grid} ### compare-grid {#compare-grid} Side-by-side cards. `verdict` is `good`, `bad`, or `neutral` — sets the top-border color. Scope variant — set `verdict` to `in` (green border) or `out` (muted), and use `items` for a bullet list inside the card. `content` and `items` can coexist — content renders first, items below. Set `"preview": true` on the grid to turn it into a **picker**: every card whose `href` is an in-page anchor grows a silhouette of the figure that follows that anchor. The picture is cloned from the rendered figure rather than authored beside it, so it can never disagree with what the reader lands on. Writing is dropped — a figure laid out for the full column is shown at roughly a quarter of it, where a label is dirt rather than text — and the card's own title carries the name. A card that links to prose, or to nothing, is left exactly as it is, so the flag is safe to set on a mixed grid. [`docs/charts.md`](charts.md) uses it for all 53 chart types. ### step-flow {#step-flow} Numbered cards for ordered actions, build steps, or migration paths. ### timeline {#timeline} An ordered sequence where each entry carries a **state**. Reach for it when the order and the state are both part of the point: a debugging story where a claim is later corrected, a decision log, an incident sequence, a release history. The neighbour is [step-flow](#step-flow), and picking the wrong one is the usual mistake. A step-flow is a **procedure the reader is meant to follow**, so every step is equally true. A timeline is a **record of what happened**, and an entry on it can be a claim that was dropped — which is why the dot carries a status and the step numeral does not. `status` is one of `note` (default, quiet hollow dot), `done` (filled, settled), `open` (hollow, claimed but not settled) or `dropped` (hollow, retracted or superseded). `label` is the author's own word for the entry — the status carries the colour, the label carries the meaning, so `"claim #1"`, `"2026-03-04"` and `"v0.4.0"` all work without inventing a colour each. ### copy {#copy} A region the reader is meant to take away, and — when the point is an edit rather than a quotation — the text it replaces. It exists for one sentence a reviewer writes often: *replace this with that*. Three formats, one source. **Markdown** is the source verbatim, so a round trip through the clipboard changes nothing. **Plain** is the same text with the syntax gone, for a field that takes no markup. **Rich** is semantic HTML carrying none of this page's classes, ids or inline styles — the target applies its own, and a copy that brought this page's looks pasted in and follows no theme at all. Give `before` and the two halves are diffed word by word, so the reader sees the edit instead of two paragraphs to compare themselves. `"diff": false` turns that off where the halves are a rewrite rather than an edit. `formats` narrows the buttons. The `before` half always offers plain text alone: its job is to be *found* in the target document, and no search box takes rich text. ## live-snippet {#visual} Editable HTML/CSS/JS textarea + sandboxed iframe preview. ### live-snippet {#live-snippet} Editable HTML/CSS/JS with sandboxed iframe preview. 220ms debounce on input. `language` is currently `html-css-js` (the only v1 mode). The Reset button restores the original `source`. ## Inline kinds {#inline} Used inside any richString — paragraph.content, list.items[*], callout.content, etc. Mix strings with these objects in an array. ### glossary-term {#glossary-term} Hover for a tooltip with the definition; click to pin. Resolves the `term` attribute against the active glossary domains in priority order. `in` disambiguates when two domains use the same term. `lang` overrides the project language for that instance. ### filepath {#filepath} `[label](#f/ )` — a path the reader can look inside. Hover for a preview, click for the whole file, and the copy button hands over the path itself. Reach for it wherever you would otherwise have put a path in a code span; `oku check` says `path-in-code-span` when it finds one that names a real file. The label is what shows, so an author writes the path twice and the second one is what GitHub links. The path is resolved against the page's own directory first, then against the project root — prose writes paths from the root ([`src/oku/cli.py`](#f/src/oku/cli.py)), which is how a reader would type them into an editor, and a path beside the page keeps meaning that even if a file of the same name appears at the root. An absolute path is taken as written. A path may end in a line or a range, the way a compiler prints it: [`starter.md:3`](#f/../src/oku/templates/starter.md:3), [`starter.md:1-6`](#f/../src/oku/templates/starter.md:1-6). The card then previews the rows around that line instead of the top of the file, the viewer opens on it with the lines marked — a markdown file in its Source view, since a line number is a line of the source — and the editor link opens there too. The whole string is tried as a path first, so a file whose name really ends in `:2` stays reachable, and a page naming several lines of one file carries that file once. `oku check` says `filepath-line` when the line is past the end of the file. Every kind opens in the same [viewer](#markdown-viewer) a prose link to a `.md` opens, filling the window, with the file's full path and a way back: a `.md` rendered, anything that reads as text as highlighted code with the language taken from the extension, an image, video or audio file as itself. A still image opened from the page itself gets the pan-and-zoom lightbox instead, where the reader wants to look closer. Reach for it wherever you would have written the path in a code span, a table cell included — a table of files is a list of things the reader has to go and find, which is the dead end the chip exists to close. `oku check` says `path-in-code-span` at warning when a span names a file that is really there, and `oku check --fix` rewrites them: prose, GFM cells and `oku-*` payloads alike, leaving front matter, plain fences and existing links alone. Only a span holding a separator is judged, so a bare `kit.json` — the file a sentence tells the reader to create — is never mistaken for this project's own. The bytes travel INSIDE the page — the files it names, the files THOSE name, so a chip inside a viewed file opens too, and the images a viewed markdown file shows, each found from that file's own directory — which is what makes the preview work in all three delivery modes — no mode can fetch the file at read time, because the interesting references point outside the served tree and a standalone page has no origin to fetch from. That is also the limit: a file over the size cap, or one resolving outside the project root, gets a chip that names it and copies its path and says on hover why there is nothing more. `oku check` reports both, so a preview that will not open is a build-time message rather than something a reader discovers by clicking. An image a viewed file shows travels up to 2 MB each and 4 MB in all, the files nearest the page first; one past that is looked for where the page was opened. ### ext-ref {#ext-ref} Like glossary-term but for external entities (tools, papers, people). Same hover-bridge-pin behavior. Reads from `_oku/extrefs/ .json` (or project kit.json overrides). Each entry has a `summary` and a `link`; the tooltip shows the name + summary, with a Learn more button to the link. ### code, em, strong, link {#code-em-strong-link} Footnotes and reference-style links resolve across the whole page, so a definition can sit far from its use — at the end of the source, or in another block entirely. The paragraph below is live: a footnote[^ref-demo] and a [reference link][pagefind-site] rendered from the definitions at the bottom of this page. ```markdown A claim that needs a source[^ref-demo] and a [reference link][pagefind-site]. [^ref-demo]: Definitions may appear anywhere on the page. [pagefind-site]: https://pagefind.app "Pagefind" ``` Inline constructs nest in either order — a link inside emphasis, emphasis inside a link, a code span inside bold. Only a code span keeps a literal body, so markdown written inside backticks stays visible as source. Link text may hold brackets as long as they balance, and a bare address is a link — GitHub's extended autolink. Punctuation that ends the sentence stays out of the link, a closing parenthesis joins it only when the address opened one, and the host needs a dot, so `http://localhost` stays text. An email address is a `mailto:` link the same way, bare or in angle brackets; `kisi@localhost` stays text. ## Per-page metadata {#metadata} Two fields are yours to write: `title` and `summary`. Everything else is either derived or inherited from the tree, and every one of them can still be overridden per page when the default is wrong. `summary` earns its place twice — it is the nav tooltip, the llms.txt entry and the search excerpt, and it fills the cover subtitle when no `subtitle` is set. `title` The page title. The only field with no sensible default. `summary` One line. Nav tooltip, llms.txt entry, search excerpt — and the cover subtitle when `subtitle` is absent. `order` Sort key in the site-tree nav. Lower sorts earlier; ties fall back to title. `parent` Page id of the parent — nests this page under it in the site tree. `accent` Named token (teal, amber, indigo, rose…) or any CSS colour. Set it once for the tree in `kit.json`; a page overrides only when it genuinely differs. `audience` Free-form reader label shown in the cover meta row. Tree-wide in `kit.json`; per-page override for the odd maintainer-facing page. `read_time` Estimated from the body at 220 words per minute, and omitted below two minutes. Set it to override; a hand-counted figure goes stale on the next edit. `updated` The file's last commit date. Deliberately not the filesystem mtime — a fresh clone would stamp the whole tree as updated today. Renders as a quiet italic line, and is suppressed when it equals `date`. `eyebrow` Small label above the H1. Leave it out unless it says something the nav does not already show. `subtitle` One paragraph under the H1. Only needed when the cover should say something other than `summary`. `date` Publication date, displayed verbatim — the kit never parses it. `lang` BCP-47 code for this page — `lang: tr`. Write it when the document is in one language and its filename does not say so; a `. .md` filename sets it for a translation, and that spelling only works where `kit.json` declares the codes. It reaches ` `, so it decides which hyphenation dictionary breaks a word at the end of a justified line, how `text-transform: uppercase` maps a letter (Turkish `i` is `İ` under `tr` and `I` under anything else), the voice a screen reader uses, and which string table the kit's own chrome reads. Derived when absent: the one language `kit.json` lists when it lists one (`"languages": ["tr"]` — a tree in one language, with no switch), else `en`, because the attribute has to say something for the browser to act on. > [!TIP] Where a default belongs > A value that is the same on every page of a tree belongs in > `kit.json`, not repeated in eleven front-matter blocks. A value the > body already implies — how long the page takes to read, when it last > changed — belongs to the build. `oku check` warns when a page sets a > field it did not need to. ## Build outputs {#build} oku build produces three trees under dist/, one per audience. Authors don't need to run it during dev — the runtime renderer fetches JSON directly — but build is required for search, the standalone single-file mode, and the llms.txt sitemap. > [!SUCCESS] Pagefind search — optional dependency > If pagefind is on PATH (brew install pagefind, or npx pagefind), build also indexes dist/site/ into dist/site/pagefind/. Soft-fails without it. The search button in the chrome only works on built sites. ## Layout / chrome — not in the page JSON {#layout-chrome} page-chrome, page-nav, page-toc are set in the HTML stub, not the page JSON. The stub copy-pastes from src/html_doc/templates/starter.html and you usually don't touch it. ```html window.addEventListener('DOMContentLoaded', function () { OkuRenderer.autoBoot(); }); ``` - ` ` — system cluster top-right (search, warning, and the presentation menu that holds text size, column width, theme, language and placeholders). Edge tabs for sidebars. Visual Viewport pinch-zoom tracker. - ` ` — boxed site-tree at the top of the Contents drawer; reads site-manifest.json (or the inline window.__okuManifest in standalone builds). Marks the active page. The Contents button in the top-left chrome strip drives it, and what it does depends on how you use it: hover and the panel appears over the page until you pick a heading or move away, leaving the measure untouched; click and it pins, insetting the column so you can read with the outline beside you and the highlight following your position. Clicking a heading in a pinned panel navigates without closing it. Below 900px there is no room to inset, so a click opens it over the page as before. When the tree has a front door (the index.html oku init writes), the label over the rows leads to it and is marked while you are on it — a tree with no index.md has no row that would. Footer at the bottom carries the kit version. - ` ` — section-TOC stacked under the site tree inside the same left sidebar. Heading reflects the current page title; the list is built from main > section > h2/h3 after the renderer fires oku:rendered. The two lists scroll on their own and the TOC claims height first — up to 64% of the column, the tree taking the rest — so a long tree never pushes the outline of the page being read out of sight. Each tree row shows the file's name under its title. The filter beside the Contents button narrows both lists as you type: case and accents fold (`turkiye` finds `Türkiye`, `isik` finds `Işık`), a three-letter-or-longer word may match as a compact subsequence (`tkt` finds `Tüketici`), every word has to match, the matched letters are marked and each list shows how many of its entries remain. Down and Up walk the results, Enter follows the first, and Escape clears before it closes. > [!TIP] Customizing the layout > The kit defaults work for ~all KB pages. For one-off pages (a single-page artifact, no nav), drop the ` ` element from the stub. Without it the layout falls back to two-column (TOC on left, like v1). The renderer doesn't care; it only owns ` `. ### Updating the page on screen · `OkuRenderer.update` {#update-in-place} An embedder that hands the page over again — an editor's preview, after every edit — calls `new OkuRenderer().update(page)` instead of `render(page)`. It builds the new page off screen, keeps the live node of every block whose markup did not change, and puts the block the reader was looking at back at the same height on the screen. An open ` `, a table's filter and view, a pinned chart reading and a diagram already drawn survive an edit to another block. Everything else is as after `render`: the title, the language, the accent and the carried files are the new page's, and `oku:rendered` fires, so the contents and the rail rebuild. It returns `{kept, built}`, the number of blocks kept and built, or `null` for a page it refuses — not `{k: "page"}` — leaving the screen as it was. Before anything has been rendered it renders. [oku preview](cli.md#preview) writes the page to hand over beside its HTML. ### A host that opens files · `window.__okuHost` {#host} A page shown inside an editor has a better place to open a file than the kit's viewer: the editor, on the right line. The embedder says so before the reader clicks: ```js window.__okuHost = { name: 'IntelliJ IDEA', openFile: function (path, line, anchor) { /* open it */ return true; }, revealLine: function (line) { /* optional: put the caret on this source line */ }, pageTop: function (line) { /* optional: the reader scrolled; this source line is at the top */ }, }; ``` The kit asks it first wherever a reader opens a file — a file chip, a link to a local `.md` — with the file's full path, the line a `#f/path:120` reference names, and the heading id a link like `other.md#setup` names (each `null` when there is none). The kit passes the id rather than a line because the line of a heading on another page is the host's to find: [oku preview](cli.md#preview) answers it. Anything but `true`, or a throw, keeps the kit's own behaviour, so a host that cannot open one file never leaves the reader with nothing. The full path is the one the viewer shows: derived on a page opened from its tree's `dist/standalone/`, stated by `oku serve` on loopback, and read from the inlined manifest's `root_abs` on a page [oku preview](cli.md#preview) wrote. A page that knows no full path never asks. ### Following an editor · `OkuRenderer.scrollToLine` {#source-lines} Beside an editor, the page and its source scroll as one. `OkuRenderer.scrollToLine(line)` puts a source line (1-based, fractional allowed) at the top of the window; `OkuRenderer.lineAt(y)` says which source line is at a height in the window. Between two blocks the position is interpolated by line, so a long paragraph or code block scrolls through as its lines go by instead of the page jumping once per block. Both need to know where each block starts, which only a page [oku preview](cli.md#preview) wrote carries; on any other page `scrollToLine` does nothing and returns `false`, and `lineAt` returns `null`. The lines follow an edit: after [update](#update-in-place) a kept block answers with its new line. The other direction is the host's: when it has `revealLine`, a double-click on the page hands it the source line under the pointer. Not on a link, a control or a chart, which answer a double-click of their own. When it has `pageTop`, the reader scrolling the page hands it the source line now at the top, at most once a frame, so the editor can follow. Only the reader's scrolls are reported: one `scrollToLine` made is not, or the editor would be moved to where the page landed and the two would chase each other, and neither is a scroll the page makes on its own (keeping the reader's place across an update, a deep link). A scroll counts as the reader's while a pointer is held on the page, or within a second of a wheel, key, pointer or touch on it that came after the last `scrollToLine`. ## Cross-cutting features {#cross-cutting} Behaviors that don't introduce a new block kind but change how an existing one renders. ### Citation cards via ext-ref {#ext-ref-cards} Existing `ext-ref` entries auto-promote to type-themed citation cards (paper / rfc / release / blog / other). Type is read from the extref entry or inferred from the link domain. Inline cite text inherits the type's color on its dotted underline; the hover card carries a type-tinted icon, a mono domain pill, optional author + date row, and a summary. Inline sample — hover any reference to see the card: see [Iceberg paper](#x/Iceberg paper) for the original snapshot-isolation argument, [RFC 9457](#x/RFC 9457) for the HTTP problem-details format, and the [Iceberg 1.4 release](#x/Iceberg 1.4 release) for cross-engine sort orders. ### Synced hover pairs · [data-bind] {#data-bind} Add `bind: "step-3"` to any two blocks and they flash together when either is hovered or focused. Click one — the offscreen partner scrolls into view. One-line opt-in per pair; no kind change required. Inline sample — hover or focus this paragraph and the callout below tints in sync. They share the same data-bind key. > [!TIP] Paired callout > Hovering the paragraph above lights this callout's border. Hovering this callout lights the paragraph. Same key, both directions. ### Last-updated line {#meta-updated} `meta.updated` renders as a quiet italic line under the cover meta row. Pure trust signal — readers learn at a glance how fresh a page is. ### Reader placeholders · `{{key}}` {#personalization} A project declares the keys once in `kit.json`; the reader fills them in from the presentation menu, and every page swaps to their values. ```json {"personalization": [ {"key": "apiKey", "label": "API Key", "default": "sk_test_...", "type": "password"}, {"key": "projectId", "label": "Project ID", "default": "proj_demo"} ]} ``` Declare nothing and none of it runs — the Placeholders row appears only where a project has keys, which is the same rule the language switch follows. Values persist in `localStorage` under `oku-personalization`: no account, no server, and no build step, so the substitution happens at read time rather than being baked in. Substitution reaches ` `, ` ` and ` ` on its own, so a code sample needs no opt-in — writing `{{apiKey}}` in it is enough. Running prose is opt-in, because a page is full of words an author did not mean as a template: wrap the passage in an island carrying `okc-personalize-target`. In prose every swapped value renders inside a span that names its key on hover, so a reader can tell which text is theirs and which is the document's. Inside a highlighted code block the value is substituted and the span is not kept — Prism rewrites a block from its own text, so nothing that is not code survives there. Send the request to project `{{projectId}}` using `{{apiKey}}` — both of these are the reader's own values wherever this project declares those keys. ### Admonition vocab aliases {#admonition-aliases} Callout `type` accepts both the kit's original names (`warn / warning / danger / success / neutral`) and the industry-standard aliases (`note / tip / info / caution`). Each row below is the same canonical styling reached from two different vocabularies. [^ref-demo]: Definitions may appear anywhere on the page — the renderer collects them before it emits anything, then lists the referenced ones here. [pagefind-site]: https://pagefind.app "Pagefind"