CorvidLabs
documentation

3md docs.

Everything you need to read and write .3md - Markdown with one free Z axis you name yourself.


Quick start

A 3md document is plain UTF-8 text with three regions in order: a required frontmatter block, an optional Markdown preamble, then zero or more planes. Here is a complete, minimal document.

my-week.3mdminimal document
---
3md: 1.0
axis: time
title: My Week
---
Optional preamble Markdown.

@plane z=0 label="Monday"
# Monday
- [ ] Standup

@plane z=1 label="Tuesday"
# Tuesday

The 3md: line is the magic marker - a document without it is not 3md. The axis names what depth means (here, time). Each @plane directive slices the document along Z; everything between directives is ordinary Markdown.

The format

3md is Markdown extended along a single free axis, called the Z axis. A document is a stack of planes, and each plane is ordinary Markdown. The grammar is frozen at version 1.0.

Frontmatter

The document MUST begin with a frontmatter block: a line containing exactly ---, one or more key: value lines, and a closing line containing exactly ---. It is its own tiny, flat, line-based mini-format - it only looks like YAML. It is NOT YAML: there is no nesting, no lists, no anchors, and no multi-line values. Each line is split on the first colon; blank lines and lines starting with # are ignored.

frontmatterreserved keys + free metadata
---
3md: 1.0          # required - the magic marker
axis: frame       # optional - defaults to "layer"
title: Bouncing dot
author: leif      # free metadata, always a string
fps: "12"          # quotes are stripped; value stays a string
---

The @plane directive

A plane begins with a directive line whose first whitespace-delimited token is @plane, followed by space-separated key=value attributes. The directive MUST begin at column 0 and MUST lie outside a fenced code block. Every line after it, up to the next @plane or end of file, is that plane's Markdown body (leading and trailing blank lines are trimmed).

@planeattributes
@plane z=2 x=-16 y=-26 label="backdrop" author="counsel"
# Backdrop
midnight curtain

Single-plane shorthand

If a document has frontmatter but no @plane directives, the entire body is one implicit plane at z = 0. A normal Markdown file with a 3md header is a valid one-plane document.

note.3mdone implicit plane at z = 0
---
3md: 1.0
title: A plain note
---
# Just Markdown
No directives, so this whole body is one plane.

Cross-plane links

A plane body MAY reference another plane by its z position with a double-bracket link. The grammar is [[z= followed by a finite decimal, an optional | and link text, then ]]. The matching regular expression is \[\[z=([^\]|]+)(?:\|([^\]]*))?\]\]. If the captured target is not a finite decimal, the sequence is not a link and stays literal body text.

links[[z=N]] and [[z=N|text]]
See [[z=2]] for the details,
or jump [[z=0|back to the start]].

The core parser leaves links in the body verbatim. Implementations expose them through a separate extraction step that reports the source z, target z, optional text, and whether a plane with that target exists (targetExists) - which makes dangling-reference validation and navigation portable across implementations.

Install

Three parsers are kept in lockstep by a shared conformance suite: a cross-platform Swift parser (ThreeMD), a TypeScript port, and a Rust crate. Pick your stack.

SwiftSwiftPM
// Package.swift
.package(
  url: "https://github.com/CorvidLabs/3md",
  from: "1.0.0"
)

// then depend on the product
.product(name: "ThreeMD", package: "3md")
TypeScriptGitHub Packages
# point the scope at the GitHub registry once
echo "@corvidlabs:registry=https://npm.pkg.github.com" >> .npmrc

bun add @corvidlabs/threemd
Rustthe threemd crate
cargo add threemd

The threemd CLI

The threemd command-line tool ships with the package and self-documents (run threemd --help). A path of - reads from standard input.

threemd CLIvalidate · info · html
threemd validate <file>   # parse; print "ok" or exit non-zero
threemd info <file>       # version, axis, title, plane positions
threemd html <file>       # render the document to HTML on stdout

Install the CLI via Homebrew with brew install CorvidLabs/tap/threemd. With the Swift package you can also run it directly: swift run threemd validate <file>.

Examples

Learn by reading real documents that span many axis types - time planners, frame animations, layered annotations, and spatial scenes wired with cross-plane links.