Skip to content

Module reference ​

Every module is sparkles.doc_view.<name>. The first group moved from hue unchanged in behaviour (UIA14); the second is what embedding needed.

The document pipeline (from hue) ​

ModuleWhat it holds
documentDocument, ContentKind, DocumentPipeline — read → detect → highlight → parse, with the fetchUrl, readFile and include hooks a host sets
viewer_modelViewerModel: the widget tree, its frames and display list, the identity rows, folds, search and match rects, scroll and the NAV5 anchor
preview_modelPreviewModel and buildPreviewModel: the markdown structure and every fence resolved once
ansi_modelthe neutral styled-line types an ```ansi fence decodes to
ansi_decodedecodeAnsi, an off-screen libghostty-vt terminal; compiled where the consumer links sparkles:ghostty
dsv_viewthe DSV adapter onto the markdown table view, its model, window and copy contract
table_select2-D table selection and its serialisation
diff_sessionthe changed-file session, and selectionPatch
diff_viewthe diff document view (unified and split)
diff_structural, diff_token_view, diff_commutative, md_diffgrammar-aware diff emphasis, commutative containers, the rendered-markdown diff
coverage_discovery, coverage_rebasefinding a coverage artifact and re-anchoring it onto the current file
document_sessionDocumentSession, the interface a host's per-document session (hue's format preview) attaches through

V8 coverage snapshots ​

DocumentPipeline.attachCoverage projects a multi-script V8 artifact to the document's path (or its title for an embedded source) before resolving sources. Only the selected script is mapped, against the immutable UTF-8 Document.source snapshot already loaded; attachment does not reread the source file from disk or use this snapshot for unrelated scripts. Native UTF-16 producer boundaries become exact original UTF-8 inline spans and source line numbers. An unavailable unrelated script does not prevent the selected document's overlay.

Invalid selected-script offsets, including surrogate interiors and offsets past the snapshot, warn and leave an undecorated document, rather than silently clamping or skipping ranges. See the coverage library's snapshot and selection contract.

Embedding ​

ModuleWhat it holds
includeexpandIncludes, VitePress @include resolution, confined and total (VIW5, VIW7)
kindViewKind, viewKindOf: what the viewer can show of a file, decided before opening it (terminal TDV1)
view_opsemitVisibleOps, the document's paint loop shared by hue's window and the pane
paneDocViewEnv, DocViewPane, PaneKey, chromeTheme; compiled where the consumer links sparkles:ui-raylib

The pane's keys ​

KeysAction
j / ↓, k / ↑one row
Space / PgDn, PgUpone page
Ctrl+D, Ctrl+Uhalf a page
g g / Home, G / Endtop, bottom
vpreview → highlighted → plain
l, cfile line numbers, fence line numbers
/, n, Nsearch, next match, previous match
z a z z z c z ofold at the top row: toggle, close, open
z r, z m, z 1–z 9open all, close all, fold to a level
z h / Shift+←, z l / Shift+→, Shift+Home, Shift+Endsideways
q, Escclose the pane (Esc first ends a search)