Introduction

K2F is a document format for pixel-identical, semantically editable documents. You author meaning as JSON; one reference engine compiles it, and every viewer paints the same output.

Package model

A .K2F file is a ZIP. You edit two layers; k2f pack / compile writes the third:

LayerPathWhat it is
Contentcontent/root.jsonSemantic tree: stable id, role, and content. No coordinates, colors, or font sizes.
Themestyles/theme.jsonAppearance keyed by role (and optional variant). Fonts live here and under assets/fonts/.
Lockdocument.K2F.lockCompiled geometry and paint operations. Viewers and exports paint this. Do not hand-edit.

manifest.json sets page size and margins; assets/ holds fonts and images. Change content or theme, then relock.

Quick install

pip install k2f

Python 3.9+. Optional: npm i @openk2f/k2f for the web viewer; cargo install k2f for a CLI without Python. For the full author loop (skill folder, init_package.py, pack_verify.py), see Getting started.

Get started

Authoring

  1. Copy golden nodes from the catalog into content/root.json children (keep id: "root"; do not replace the file with a catalog fragment).
  2. Look up allowed keys in Allowed keys, then the matching file under schema/.

Topic guides:

  • Text — paragraphs, headings, lists, inline marks
  • Images — embedded bitmaps and SVG
  • Tables — inline tables
  • Layout — stack and grid
  • Theme and fonts — roles, variants, embedded fonts

Reference

Export

Markdown or JSON → packed .K2F → PDF, PowerPoint, Word, or InDesign. The lock is the source; each file is a drawing of it.

Guides

Permanent publish links (/v/{appearance_hash}) are documented in the K2F Skill (references/publishing.md).

Agents and tools

  • K2F Skill — npx skills add suzheng/k2f --skill k2f; workflows for create, convert, export, and embed · k2f.dev/skills/k2f
  • Playground — compile and preview in the browser
  • Verify — check a .K2F file for integrity banners

Project

Contributor internals (engine design, crate map): architecture/. Not part of the authoring path.