Kribble

Specification·Updated 15 Oct 2026

Overview

The specifications, their reference implementations, and the conformance fixtures

These pages are Kribble's specifications as they are in the repository's spec/ folder, kept in step with the code that implements them.

What Kribble's content is, written down so that anyone can build on it: an editor, a renderer, a converter, an agent, a publishing pipeline. The reference implementations follow these specifications, and their tests check them against the same fixtures.



document.md

The Kribble Document Format: a note's content as JSON, blocks with ids holding text runs, parts and other blocks; and its markdown.

reference.md

Every block, part and run, with its fields (generated from the registry).

drawing.md

Drawings: the scene a drawing block holds (shapes, arrows, freehand, text, images).

diagram-language.md

The diagram language: the text diagram blocks are made from (flow, sequence, class).

chart-language.md

The chart language: bar, line, area, pie and doughnut charts from text, in ```chart code blocks.

registry.json

The registry: the machine-readable source of the document format.

schema/document.schema.json

The document format as JSON Schema (2020-12; generated).

schema/drawing.schema.json

The drawing scene as JSON Schema.

fixtures/

Conformance fixtures: valid documents, validation cases, markdown, diagrams.

Implementations


Language


@kribble/document

TypeScript

The document format: registry, types, validation, the canonical form, walking, the nesting caps. No dependencies, no DOM.

@kribble/editor

TypeScript

The editor (ProseMirror) and its renderer, and the markdown converters. It keeps a note in ProseMirror's JSON while editing and maps it to and from the format without loss.

@kribble/drawing

TypeScript

The drawing editor and renderer (canvas and SVG), and the scene model.

@kribble/diagram

TypeScript

The diagram language: parsing, layout into a scene, editing helpers.

@kribble/chart

TypeScript

The chart language: parsing, writing, drawing as SVG. No dependencies, no DOM.

kdoc

Go

The document format: registry, validation, the canonical form, walking, ids, the nesting caps.

render

Go

Notes to HTML for sites and printing: the HTML, the table of contents, search sections, drawings as SVG.

markdown

Go

Markdown in and out of the format, and editing a note through its markdown keeping what markdown can't express.

diagram

Go

The diagram language's parser, for the server.

chart

Go

The chart language's parser and SVG renderer, for sites and PDFs.

Programs in other languages get the reference converters and validator from the CLI: kribble convert (markdown ⇄ document JSON) and kribble validate.

The server validates every document before it stores it (see document.md, Validation), so what an API, an agent or an editor sends has to be a valid document; the same validation is one call away in either language (validate from @kribble/document, kdoc.Validate).

Conformance

An implementation conforms when it passes the fixtures for what it does:

Fixtures

For

fixtures/valid/

Readers and validators: valid documents in canonical form, with every block, part and run. A validator reports no problems; a reader that reads one and writes it back gives the same bytes as the fixture without its indentation.

fixtures/checks/

Validators: a document and the exact problems (severity, code, path) to report, in any order.

fixtures/canonical/

Writers: a document and its exact canonical bytes (strings, numbers, scene key order, clean-up).

fixtures/merge/

Editors: base, server and mine, and their merge (null for a conflict).

fixtures/markdown/

Markdown converters (see document.md, Markdown).

fixtures/diagrams/

Diagram language parsers and layouts (see diagram-language.md).

fixtures/charts/

Chart language parsers and renderers (see chart-language.md).

The TypeScript packages run them with pnpm test:packages, the Go ones with go test ./internal/format/... ./internal/diagram/... ./internal/chart/... in backend/.

Changing the format

  1. Change the registry (registry.json) and the page that describes it. Decide whether the change fits the current version (document.md, Versions) or needs a new one with a migration.

  2. pnpm spec:generate writes what comes from the registry: the JSON Schema, the reference, and the copies @kribble/document and kdoc embed. pnpm spec:check fails when any of them is out of date, and so do both packages' tests.

  3. Add fixtures for it: a valid document using it, and a check for anything new a validator should report.

  4. Implement it: the editor's schema and its mapping (packages/kribble-editor/src/editor/prosemirror-json.ts; its test fails until the valid fixtures map), the markdown converters (TypeScript and Go, with markdown fixtures), the renderers.