The K2F format operates on a dual-state architecture: an editable, declarative semantic JSON tree (State A) and a compiled, pixel stable lock (document.K2F.lock / State C) packaged inside a self-contained ZIP archive. While Markdown delegates typography, line wrapping, and visual layout entirely to downstream client environments (such as web browsers, static site stylesheets, or PDF converters)—producing fluid, viewport-dependent reflow without native concepts of physical pages, margins, or bounding boxes—K2F compiles semantic intent into deterministic geometry using a dedicated Rust reference layout engine (k2f_layout), strictly isolating content meaning from visual theme primitives and mandating embedded fonts.

K2F is not a lossless superset of Markdown. While K2F provides a deterministic import bridge (markdown_to_k2f) to ingest Markdown into a .K2F package and an export utility (k2f_to_markdown) to extract clean text, round-trip conversion is lossy. Re-exporting a .K2F package to Markdown drops the visual theme (styles/theme.json), the compiled geometry lock, persistent dotted node IDs, and cryptographic signatures. Furthermore, the K2F v0.1 import bridge requires an author directory shell (--template) containing fonts and styles, and explicitly skips non-semantic constructs such as raw HTML, YAML/TOML frontmatter, task checkboxes (- [ ]), footnotes ([^1]), and remote image URLs. In addition, K2F does not import PDF or HTML files (PDF_IS_NOT_A_SOURCE), and downstream deliverables exported from the lock cannot serve as authoring sources.

At a glance

TopicMarkdownK2F
What the file isPlain-text markup file (text/markdown, RFC 7763; CommonMark / GFM)Declarative semantic JSON tree (State A) + compiled render lock (State C) in a ZIP archive
Primary authoring modelHuman plain-text typing, developer documentation, and native LLM conversational text generationProgrammatic authoring, inspection, and patching by AI agents and automated code pipelines
Physical page geometryZero native concept of pages, paper sizes (A4, Letter), margins, columns, or spatial bounding boxesExplicit paged canvas geometry, margin definitions, multi-column stacks, containers, and page budgets
Rendering architectureRuntime layout computed by client viewers, web browsers (DOM/CSS), or downstream converters (Pandoc)Dual-state model: reference engine compiles deterministic geometry; viewers paint document.K2F.lock directly
Pixel-stable pages & fontsNon-pixel-stable; relies on viewer system fonts; word wrapping and pagination reflow per deviceYes — viewers paint the lock directly; mandatory embedded fonts guarantee cross-device pixel stability
Node addressing for AIZero native IDs; derived heading anchors change on edit; agents scrape line offsets or regexMandatory, hierarchical dotted IDs (parent_id.child_type_semantic_name) on every semantic node in State A
Agent round-trip fidelityAST re-serialization causes cosmetic churn (list markers, table spacing, emphasis syntax)Git-native Canonical JSON (sorted keys, 2-space indentation) ensures clean semantic diffs; schema-validated
Separation of concernsZero styling syntax; authors inject raw HTML/CSS (<div style="...">) to manipulate appearanceStrict separation: zero styling on State A nodes; visual primitives live exclusively in styles/theme.json
Theming & global restylingScattered across external CSS stylesheets or inline HTML overrides; no standard document tokensSingle token change in styles/theme.json restyles entire document deterministically upon recompilation
Interactive formsNo native fillable form controls; manual underscores (____) remain inert plain textNative form_field semantic nodes compile directly into genuine interactive AcroForm PDF exports
Vector graphics & mediaMarkdown image syntax (![]()) or raw inline SVG; supports remote web URLsForbidden in State A JSON; external vector graphics stored as pre-rendered SVGs in /assets/ (local files only)
Multi-format supply chainCompiles directly to HTML; conversion to Word, InDesign, or PDF requires fragile Pandoc/LaTeX pipelinesSingle-source lock-drawn exports to PDF (with AcroForms), Microsoft Word (.docx), PowerPoint (.pptx), and InDesign (.idml)
Integrity & signaturesZero native hashing, checksums, or tamper-evident mechanisms in the file formatDual-hash architecture (content_hash, appearance_hash), Ed25519 signatures, mandatory viewer banner (SIGNED, UNSIGNED, SIGNED_BUT_BROKEN, BROKEN_INTEGRITY, UNLOCKED)
Verification toolingSyntax linters (markdownlint); no document schema validationAutomated schema validation via pack_verify and CLI k2f verify before compilation
Import / Source of truthEstablished editable source for technical docs; K2F provides import bridge requiring --template.K2F is sole source of truth; no PDF import (PDF_IS_NOT_A_SOURCE); exports are unidirectional lock renderings (*_IS_NOT_A_SOURCE)

Markdown vs K2F: What Markdown is good at

Markdown is the established standard for developer documentation, plain-text note-taking, and conversational AI generation. Its core strengths include:

  • Frictionless ubiquity and zero tooling overhead: Markdown files (.md) are lightweight plain text readable across every computing environment, operating system, terminal, and embedded device using standard utilities (cat, nano, vim, curl). Creating a document requires zero build steps, specialized SDKs, or archive unpackers.
  • Native LLM fluency and token efficiency: Large Language Models are pre-trained on billions of tokens of Markdown prose, READMEs, and technical documentation. Emitting Markdown requires minimal token overhead compared to JSON ASTs or structured XML, resulting in faster generation speeds, lower API costs, and virtually zero syntax errors.
  • Progressive token-by-token streaming: LLMs can stream Markdown text token-by-token directly into conversational UI chat interfaces with immediate, progressive rendering. Users read text in real time as the model generates words, without waiting for an entire document package to assemble and compile.
  • Human-readable Git diffs for prose: Git diffs for Markdown files display clean, word-for-word prose edits. Reviewers see exact additions and deletions without wading through structural JSON brackets, quotation marks, escape sequences, or whitespace indentation formatting.
  • Fluid, responsive web publishing: Paired with static site generators (Astro, Docusaurus, VitePress, Hugo, MkDocs) and platforms like GitHub, Markdown powers modern technical documentation. Text automatically reflows to fit mobile screens, tablets, and wide desktop monitors without breaking layout continuity.
  • Extensive ecosystem of tooling: Thousands of mature, open-source utilities support Markdown, including linters (markdownlint), code formatters (Prettier), parsing ecosystems (Unified / Remark, pulldown-cmark), and universal converters (Pandoc).

What K2F adds

K2F is designed for workflows where automated systems and AI agents require deterministic structure, verifiable rendering, and multi-format delivery:

  • Declarative semantic tree & stable dotted IDs: Every node in State A (content/root.json) carries a mandatory, hierarchical dotted ID (e.g., financials.q3_results.table_revenue, contract.clauses.clause_4_indemnity). AI agents target, read, patch, diff, and revert specific content nodes deterministically without scraping visual coordinates, guessing line number offsets, or relying on fragile regex string matching.
  • Deterministic layout compilation & pixel-stable lock (document.K2F.lock): K2F pairs an editable semantic tree with a compiled render lock (State C). The Rust reference layout engine (k2f_layout) calculates exact physical coordinates using HarfBuzz text shaping (rustybuzz), Unicode line breaking (UAX #14), and IEEE-754 math layout. Official viewers (<k2f-viewer>, Desktop Reader) paint the published lock directly without running layout or reflowing body text in the browser, guaranteeing PDF-grade visual consistency.
  • Mandatory embedded fonts: Markdown relies on the client device's installed fonts or external web stylesheets, causing radical typography and line-wrapping variances between operating systems. K2F mandates complete embedded fonts in assets/fonts/ and strictly prohibits system font fallbacks, ensuring identical rendering on every machine.
  • Strict intent-presentation separation & global restyling: Markdown lacks visual styling primitives, forcing authors to inject non-standard raw HTML with inline CSS (<div style="...">) to control appearance. K2F strictly forbids inline styling on State A nodes; appearance is governed entirely by named design primitives in styles/theme.json. A single prompt or theme edit restyles an entire document deterministically upon recompilation without layout drift.
  • Paged document architecture & visual design primitives: K2F natively handles multi-column layouts, page sheet fills, page budgets, card containers, elevation/shadow atoms, rounded corners, glassmorphism, running headers, and footers without leaking presentation into content.
  • Dual-hash cryptographic integrity & mandatory viewer banner: Markdown is unauthenticated plain text that can be modified without forensic traces. K2F implements a built-in cryptographic integrity architecture: content_hash hashes the canonical semantic tree, while appearance_hash binds content, theme primitives, embedded fonts, canvas setup, and the pinned reference engine identity (engine_commit_sha). Official readers enforce a mandatory integrity banner reporting five canonical states (SIGNED, UNSIGNED, SIGNED_BUT_BROKEN, BROKEN_INTEGRITY, UNLOCKED), while reporting layout engine discrepancies (ENGINE_MISMATCH).
  • Automated package verification (pack_verify): Every .K2F package embeds formal JSON schemas (/schema/). Verification utilities (pack_verify, CLI k2f verify) validate structural rules, font coverage, and modifier constraints, allowing AI agents to self-diagnose and repair schema violations before compilation.
  • Native fillable PDF forms (AcroForm): K2F's form_field semantic nodes compile directly into interactive AcroForm PDF fields upon export. In Markdown, form blanks written as underscores (____) remain inert, non-interactive text.
  • Single-source multi-format export pipeline: A single .K2F document compiles once to produce lock-drawn deliverables for PDF (with interactive AcroForms), Microsoft Word (.docx), PowerPoint (.pptx), and Adobe InDesign (.idml). Markdown requires complex, multi-stage Pandoc and LaTeX pipelines that frequently break visual formatting.
  • Agent tooling and template ecosystem: K2F provides an official agent skill implementing the agent_v0 authoring dialect and a public Gallery of 469+ templates on k2f.dev with multi-format downloads (.K2F, .docx, .pptx, .idml) without requiring accounts or subscriptions.

When to pick which

  • Pick Markdown when:

    • Writing evolving software documentation, developer READMEs, architecture decision records (ADRs), or technical blog posts.
    • Drafting personal notes, knowledge bases (Obsidian, Logseq), or conversational scratchpads where fluid text reflow across screens and devices is desired.
    • Streaming real-time LLM chat responses token-by-token directly into conversational UI interfaces.
    • Publishing directly to static site generators (Astro, Hugo, Docusaurus, VitePress) for web consumption.
    • Managing lightweight plain-text repositories where zero tooling overhead and friction-free editing in any terminal or text editor are essential.
  • Pick K2F when:

    • Creating formal, paged deliverables (contracts, financial reports, whitepapers, invoices, proposals, certificates, planners, or fillable application forms) that demand exact typography, page budgets, and print-ready presentation.
    • Autonomous AI agents and automated code pipelines must programmatically inspect, target, patch, and validate document content using stable dotted node IDs without fuzzy text scraping or regex drift.
    • Documents require strict cross-device, cross-platform pixel stability via embedded fonts and a compiled geometry lock (document.K2F.lock), eliminating viewer-dependent line reflow.
    • Publishing from a single source of truth to PDF (with interactive AcroForms), Microsoft Word (.docx), PowerPoint (.pptx), and Adobe InDesign (.idml) simultaneously.
    • Documents require cryptographic tamper-evidence (content_hash, appearance_hash, Ed25519 signatures) and standardized viewer integrity banners.
  • Using Markdown as an authoring on-ramp to K2F:

    • Markdown and K2F are not mutually exclusive. Workflows can leverage Markdown as an authoring on-ramp: AI agents or human authors draft raw content in Markdown, pass it to k2f markdown input.md --template ./source -o output.K2F to attach an author shell and embedded fonts, and then manage the resulting .K2F package as the canonical, locked deliverable. Deliverables exported from K2F are unidirectional drawings of the compiled render lock, not editable sources of truth (PDF_IS_NOT_A_SOURCE, DOCX_IS_NOT_A_SOURCE, PPTX_IS_NOT_A_SOURCE, IDML_IS_NOT_A_SOURCE). All authoritative structural updates must occur in K2F State A.

Bottom line

For additional details on K2F architecture, explore the technical documentation, review pre-built templates in the Gallery, read why K2F exists, or view the full matrix on Compare.

This comparison is based on publicly available information at the time of writing. Capabilities, pricing, and policies may change; verify details with the relevant provider.