orz-paged — documents & layout
This page describes orz-paged 1.1 (orz-paged-browser 1.1), which embeds orz-markdown 2.5
Markdown that edits itself, laid out as print-ready pages. This page describes orz-paged 1.1: the text twin and its file, the header, templates and print themes, page furniture, versions, columns, printing and the CLI. Part of the orz editable-document family, with orz-mdhtml (documents) and orz-slides (decks). New to the words "text twin", "assemble" or "shell"? See the guide's short glossary.
orz-paged new --template) — the pencil's Template
item is different: it only changes the open document's template: key (which sets just the page
size) and adds no title page or content. For anything beyond that
ask an AI agent to write or restructure the text. Point it at the
orz-paged agent skill
(orz-paged-skills/SKILL.md)
and describe what you want — “a two-page report with a cover and a table of contents,” “an
exam with an answer key,” “a modern CV.” This page is the reference the agent (and curious
humans) can draw on; skim it, don't memorize it.
A text twin and a self-editing file
A document is its text twin — report.paged.md, plain Markdown with a small header
at the top — and its self-editing file report.paged.html, one HTML page that shows the
document as real print pages (A4, Letter…, margins, running headers and footers, page numbers),
edits itself in the browser, saves back in place and prints to PDF from the browser. No PDF
binary, no server. The file is always assemble(text): the exact text rides inside it, everything else
is a shell that can be regenerated, and orz-paged extract gives the text back byte for byte. Keep the
.paged.md in your repository; make the .paged.html whenever someone needs a file.
Pages in the page
Laid out by Paged.js right in the page with the header's page size, margins, theme and typography. Pages appear one by one as they are ready; what you see is what prints.
Print-first
Ink on light paper — light themes only. Everything in orz-markdown prints; tabs, spoilers and video are discouraged (they hide content or do not print), not forbidden.
One family
The same text twin, pencil, editor, saving, quiet update, host protocols and CLI as orz-mdhtml and orz-slides 1.0 — built on the orz-markdown carrier kit (text format 1). What paged adds is pages.
Published on npm as orz-paged (CLI and Node
library) and orz-paged-browser (engine and editor component), always the same version. Try the
official blank .paged.html
starter.
Create and build with the CLI
Node 20.16 or newer; nothing to install with npx:
npx orz-paged@1 new report.paged.md --template report-page --title "Q3 Review" # a new text twin # edit report.paged.md (by hand or with an agent), then: npx orz-paged@1 report.paged.md # → report.paged.html
| Command | What it does |
|---|---|
orz-paged new [x.paged.md] [--template id] [--title T] [--theme id] [--html] [--cdn] | writes a new text twin from a template (default note): its header with carrier: paged, a fresh uid and the template's settings (article-page and report-page also write front_matter: clean; no other template does), then the template's skeleton; --html also assembles it; without a file name the text goes to stdout |
orz-paged assemble x.paged.md [-o out] [--cdn | --inline] [--resolve-includes | --no-includes] [--replaces sha256] | writes x.paged.html from the text — the same bytes every time (also: orz-paged x.paged.md; a plain x.md assembles to x.paged.html). Keeps the existing file's delivery and the includes it recorded; --resolve-includes reads {{md part.md}} files from the text's folder (never outside it); an include left out shows an "Included file not available" note and is reported (unresolved, or stale when its file changed since) |
orz-paged extract x.paged.html [-o out] [--replaces sha256] | writes the exact text twin back out of a file |
orz-paged upgrade old.paged.html [--text t | --no-text] [--cdn | --inline] | turns a 0.x file (or an older 1.x shell) into a 1.0 file and writes its text twin |
orz-paged inspect <file> | says what any text or file is — version, settings, lint, whether its twin matches — and what to do next |
orz-paged themes · orz-paged templates | list the print themes and the templates |
Content — title, theme, template, page settings, versions — comes only from the text's
header; assemble has no content options. Every command takes --json (one object with a
stable reason and a next step on refusals), and nothing that could hold other work (a file
saved in the browser, an edited twin) is overwritten without --force, which keeps a
<file>~ backup — unless what it replaces is a known earlier state: what the CLI
itself last wrote or read for that pair, or a committed version of the twin in git
(glossary). The robust way for scripts and agents: assemble, extract (to a file), inspect and upgrade print the
sha256 of the text they wrote or read (so does every --json result that wrote a text;
new only with --json); pass it back as --replaces <sha256>; the file is
replaced only while it still holds that text. Exit status: 0 done, 1 refused or failed, 2 usage error.
Delivery. Files are inline by default: the engine, Paged.js and the print
themes are inside the file (about 1.7 MB). --cdn writes a small file for pages you publish on the
web; it loads the engine from jsDelivr,
https://cdn.jsdelivr.net/npm/orz-paged-browser@<version>/orz-paged.browser.js (the file's own
version, e.g. @1.0.0).
The print themes ship inside the engine, so a --cdn file styles exactly like an inline one. Either
way, webfonts, KaTeX, the content libraries and the editor load from CDNs the first time; a slow CDN never holds
the page blank (pages are laid out after at most 2 s, then once more when everything has arrived).
In the file: one quiet pencil
A .paged.html opens as its pages with a small pencil at the bottom-left. Click it to edit; hover it
(tap on a touch screen) for everything else. A dot on the pencil means unsaved changes.
Edit, Print, Save
Edit
(Ctrl/⌘ E) opens CodeMirror beside a live preview of the pages (split, editor or
preview); the preview lays out again from the page your edit changed and never blocks typing.
Print (or Ctrl/⌘ P) prints the read view once its layout has settled —
choose Save as PDF in the dialog (Chrome and Edge give the most faithful PDF). Save (Ctrl/⌘ S) writes assemble(text) back to the
file, and asks before it overwrites a file that changed on disk. Also: Download a copy, New
document, Save as new copy.
Settings are the document's
Theme, Page size,
Template, Page numbers, Number style and Version in the pencil's list (or the editor's
bar) write the text's header — one undoable edit, unsaved until you Save — and the pages follow. Margins, fonts,
running headers and custom CSS stay in the header text. Template here changes only the
template: key, whose one layout default is the page size (Letter; A4 for note; a
page_size in the header wins). It never adds a title page, clean front matter or content, so the
change can be small, even none; to start a letter, a CV or an exam, use New document from
template….
Templates
New document from template… lists
the twelve templates and saves a fresh file of the chosen one (its starter text, a new uid). The
open document is never replaced; copy content across yourself.
Page zoom
Page zoom (Automatic, Fit width, 100 %, 125 %) scales the pages for reading. It is the reader's preference, kept in this browser, never saved into the file — and it never changes pagination: pages are laid out at 100 % and only then scaled.
A local file checks at most once a day for a newer engine; the pencil then offers Update to x.y.z, which re-assembles the same text with the new release (verified by SHA-384). Nothing changes until the reader asks.
The header
One {{nyml kind: document}} block at the very top of the text configures the
whole document. Most documents need few keys: the template: the text started from (maybe
theme:, and front_matter: clean from the -page article and report starters);
the rest are optional overrides. new writes carrier and a
uid (the document's id; upgrade, New document and Save as new copy write one too, Save does not — a starter file has none, which is fine); once there is one, leave it as it is.
{{nyml
kind: document
carrier: paged
uid: doc-7kq2m9x4p1r8s3t5
title: Quarterly Report
author: Platform Team
template: report-page
theme: light-academic-1
page_size: Letter
margin_top: 20
header_center: Quarterly Report
footer_left: Confidential
page_number_position: footer-right
page_number_style: page-n-of-N
front_matter: clean
dynamic_choices: |
answer-key: hide
}}
| Key | Values |
|---|---|
template | which template the text started from; its one layout default is the page size (Letter; A4 for note) — the title page, front matter and furniture are in the text itself (below). The 0.x names article, report, exam mean the -section variants |
theme | the look: fonts, accent, element styling (below) |
page_size | A3 · A4 · A5 · Letter · Legal · or two lengths, 210mm 297mm |
margin_top · _bottom · _left · _right | in mm |
header_left/center/right · footer_left/center/right | running text in the page margins |
page_number_position | header- or footer-left / -center / -right, or none |
page_number_style | simple · page-n · page-n-of-N · n-of-N · n-slash-N · dash-n-dash · brackets · parentheses |
front_matter | clean: title, abstract and contents pages without furniture, the body numbered from 1 (written by new --template article-page / report-page; front_matter_clean: yes is an older spelling of the same) |
dynamic_choices | one key: value per indented line: the versions (below) |
Write each value alone after its key: a header has no comments (text after a value becomes part of it).
Also: font_preset (serif system-serif, source-serif-4,
lora, crimson-pro, noto-serif · sans inter,
ibm-plex-sans, roboto, raleway, noto-sans · mono
courier-prime), font_size, line_height, decoration_color,
page_background, repeat_table_header, custom_css, and the common metadata
keys (description, date, license, source, …) that the file
writes into its HTML head. Unknown keys are kept.
Templates & print themes
A template is a starter text (its header and a skeleton of elements: where the title,
contents and furniture go) that new --template and New document from template… write; the
header's template: key alone sets only the page size. A theme owns the look — so the same theme renders the same across every template.
article/report/exam each come in a -page (title on its own page)
and a -section (inline title) variant; the 0.x names article, report and
exam still work and mean the -section variant.
| Template | For |
|---|---|
article-page / article-section | academic paper — title, authors, abstract, body |
report-page / report-section | business / technical report — title, contents, header and footer |
exam-page / exam-section | exam — title, student fields, numbered questions, answer-key version |
letter · cover-letter | formal letter · job cover letter |
cv · cv-modern · cv-elegant | three résumé styles (classic / modern / elegant) |
note (default) | clean readable note |
Nine print themes, one derived from each light
orz-markdown theme, keeping its typefaces and decoration wherever they suit paper:
Orchard light-neat-3, Neat light-neat-1, Neat 2 light-neat-2, Academic
light-academic-1 (the default), Academic 2 light-academic-2, Beige
beige-decent-1, Beige 2 beige-decent-2, Playful light-playful-1, Playful 2
light-playful-2 — plus none (plain).
light-playful-1 is a ruled notebook: text, headings and formulas sit on the lines;
tables, code, callouts and figures are sheets pasted on top. Light only, by design.
Page furniture
Headers, footers, numbers
Running headers and footers
(header_left/center/right, footer_…) and page numbers in eight styles and six positions,
set in the page margins in the theme's body font and muted colour.
Contents with page numbers
A toc element lists
the sections with the page each one starts on.
Clean front matter
front_matter: clean keeps
title, abstract and contents pages (placement: page) free of furniture and numbers the body from
1.
Long tables
break between rows and repeat their header row on
each page (repeat_table_header).
Long code
breaks between lines — every line printed, in order, none cut at a page bottom.
Page breaks
Start a fresh page anywhere:
::: page-break :::
Document elements
An element is a {{nyml kind: <element>}} block placed in the body where you want it. The
curated set:
| Element | Key fields |
|---|---|
article-title / report-title | title, subtitle, authors (or author), affiliations, notes, date, doi, placement |
exam-title | title, subtitle, author, course, instructor, duration, total_points, date, student_fields, instructions, placement |
abstract | text, keywords, placement |
toc | title, max_level, placement |
letterhead | organization, tagline, address, email, phone, website, border |
letter-inside-address | to, title, organization, address, align |
letter-signature | closing, from, title, organization, signature_space |
cv-header | full_name, title, contacts, photo, summary, border |
question-mc · question-open | n, pts, body, options/space, answer |
timestamp | label, date |
placement: page gives a title (or abstract, or contents) a page of its own;
section (default) keeps it at the top of the content.
Authors, affiliations & ORCID
Each authors line is Name | marks | email | orcid — the fields after the name are
auto-detected, so order is flexible and any may be omitted.
{{nyml
kind: article-title
title: A Practical Comparison of RAFT and ATRP
authors: |
Jane Doe | 1,* | jane.doe@example.edu | 0000-0002-1825-0097
John Smith | 2
affiliations: |
1: Department of Chemistry, University of Example
2: Institute of Science, Example Lab
notes: |
*: Corresponding author
placement: page
}}
Versions — one source, several printouts
dynamic_choices in the header decides what the pages show: content tagged
data-show-when="key=value" is kept only when the choice matches, data-hide-when removes
it when it matches. The exam elements tag their answers answer-key=show, so one text prints the
student copy (answer-key: hide) and the instructor key (show). Switch it with
Version in the pencil's list or the editor's bar (a header edit), or in the text. Define your own
keys (e.g. audience: student) for any tailored document.
{{nyml
kind: question-mc
n: 1
pts: 5 pts
body: Which of these are vector quantities? (Select all that apply.)
options: |
A. Mass
B. Velocity
C. Temperature
D. Force
answer: B, D
}}
Two columns across a page break
:::: cols with ::: col blocks lays text side by side, and the columns survive a page
break. A short block moves whole to the next page when that leaves less than about a third of
the page empty; otherwise — and for a long block — it is split column by column at the page
bottom (column 1 continues in column 1). Tables in a column split between rows with their header repeated.
Nesting: a container inside a column needs more colons on every outer
level — ::::: cols › :::: col › ::: info.
Your own styling and body content
custom_css
A custom_css: | block in the
header is applied last, so it overrides the theme, and it can read theme tokens (var(--accent),
var(--surface-2), …). The cv-modern and cv-elegant templates are built this
way — copy one as a starting point.
Full orz-markdown
Between the elements, write normal
orz-markdown (orz-paged 1.1 embeds orz-markdown 2.5, so charts and Mermaid diagrams
print in the theme's colours): headings, lists, tables, code, footnotes, math, Mermaid,
{{smiles}}, {{chart}}, {{qr}} (a printed QR is genuinely useful),
callouts, columns, includes — all styled for print. A file include ({{md part.md}}) is read when you
assemble with --resolve-includes and stored in the file (its #orz-includes record, which
the file reads offline; a later assemble keeps it, --no-includes drops it); one it does not hold shows a quiet
"Included file not available" note.
Worked examples
Academic article — cover page, abstract, math
{{nyml
kind: document
carrier: paged
template: article-page
theme: light-academic-1
front_matter: clean
}}
{{nyml
kind: article-title
title: On Widgets
subtitle: A Study
author: Ada Lovelace
date: March 2026
placement: page
}}
{{nyml
kind: abstract
text: We show that widgets ...
keywords: widgets, gadgets
placement: page
}}
## Introduction
Inline math $E = mc^2$, tables, lists, all print.
Exam — student copy & instructor key from one text
{{nyml
kind: document
carrier: paged
template: exam-page
dynamic_choices: |
answer-key: hide
}}
{{nyml
kind: exam-title
title: Physics — Exam 1
student_fields: |
Name | Student ID | Score / 100
}}
{{nyml
kind: question-mc
n: 1
body: SI unit of force?
options: |
A. Joule
B. Newton
answer: B
}}
For the instructor's key, switch Version to show in the pencil's list
(or write answer-key: show).
For the full vocabulary — every header key, element field and theme — read the agent skill (orz-paged-skills/SKILL.md) or just ask an agent.
Older files and web apps
0.x files: inspect, then upgrade
A file made by
orz-paged 0.7.x or earlier still opens as it was, but the 1.0 tools and editor work on it only after a one-time
upgrade. npx orz-paged@1 inspect old.paged.html says what it is; npx orz-paged@1 upgrade
old.paged.html rewrites it as a 1.0 file and writes its text twin old.paged.md — the old
settings block and metadata become one header at the top, and the settings mean what they meant. When
old.paged.md already exists, add --text old.browser.paged.md and merge. The 0.x
commands (--template, --new, --list-templates, --title /
--theme when building) are refused with the 1.0 command that does the same, and the 0.x API
(buildPagedHtml and friends) is gone: assemble, newDocument,
inspect, upgrade.
In a web app
The editor is a component:
npm i orz-paged-browser@1, then mountEditor(element, { text, hooks }) (ES module, or
globalThis.OrzCarrier from the IIFE); its preview lays out Paged.js pages in a sandboxed frame.
Store the text; call assemble(text) only when a file is needed. See
docs/embedding.md.
.paged.html runs the engine inside it and anything in its content; open and edit files only from
sources you trust — a file cannot prove its own integrity (the verifier helps). The
quiet update only fetches this engine's own jsDelivr package, checks its SHA-384, and changes nothing until you
click Update now. A platform that shows files in an iframe can take their saves, AI requests and includes
through the host protocols (orz-host-save@1, orz-host-ai@1,
orz-host-include@1).