Open Presentation Format
OPF is an open-source JSON format for describing presentations. It separates content intent from rendering complexity, letting AI agents produce slide decks without wrestling with OOXML.
OPF versioning and the current format
OPF is pre-1.0 and the schema is identified by "$schema": "https://openpresentation.org/schema/opf/v1". OPF 0.15 is a clean break with no migration command and no aliases: a document is rewritten to the current shape, and the packages (@openpresentation/opf, render, PPTX and editor) move together. The exact contract is the JSON Schema; the 0.15 design records why.
- Catalogs are groups. A document carries the catalog records it uses under
catalogs.<group>.<kind>.<id>, and a reference is anidorname:id. References are never URLs orpkg:strings, and a per-kindrecordsarray no longer exists. Core ships no catalog records; the host registers the catalogs a document's references resolve in. - Languages, chart types and social platforms are vocabularies.
languageis a BCP-47 tag such asen-US;chart.typeand the socials keys are validated by the schema, not looked up in a catalog. - Pictures have two homes. A full-slide photo is a background of type
image; every other picture is an image block with its own fit, treatments and optional edge placement. The default fit of content images isdesign.imageFit. The per-slide image design option, the image fill default and the full-bleed image layout are gone.
OPF 0.16 added a text alternative for tables (table.alt). Markdown decks (.opf.md) are read and written like JSON and YAML, and @openpresentation/cli/api reads, exports and imports decks from code (0.17 replaces it, below). The renderer's PNG, PDF and font packages became optional installs; see Read, write and export from code.
OPF 0.17 changes the JavaScript API and the header and footer values. In code, @openpresentation/opf/node (convert, open and save) replaces @openpresentation/cli/api, which is removed, core's parse and stringify replace readDeck and writeDeck, and the CLI gains opf convert. Header and footer values are variables in the zone's text: {{slide.number}}, {{slide.section}} and {{deck.slideCount}} join {{organization.name}} and {{speaker.name}}, so { "text": "{{slide.number}} / {{deck.slideCount}}" } replaces { "slideNumber": true }. The zone keys organization, speaker, section, slideNumber and slideNumberFormat and the {current} and {total} syntax are removed with no alias, and a header or footer zone that uses one is invalid.
OPF 0.18 makes the API consistent, again with no aliases. One import works in every runtime: import * as opf from "@openpresentation/opf" has convert, open and save in Node (and rejects them with node-only in a browser), and @openpresentation/opf/node is removed. importData is ingest (and opf import-data is opf ingest); the renderer's renderSvg and renderSlideSvg are toSvg(deck, slides?, options?) with slides counted from 1, svgToPng and svgToPdf are toPng and toPdf, which also take a deck, and the editor's exportDeck is convert(deck, { format }). Logos live on the organization: organization.logo has full, stacked, icon and wordmark (each a path or asset, or { onLight, onDark }), a header or footer zone places one with { "image": "var:organization.logo.icon" }, and the LogoSet on design.logo and the zone flag logo: true are removed. The CLI's opf convert replaces render, export, import, from-md and to-md, and every command that writes a deck takes its output as a positional argument (stdout without one).
OPF 0.19 introduced named region templates and shared design defaults. In OPF 0.25 a layout is one ordered list of regions, declared once in reading order (see Layouts). Layout defaults use the record's design fields. Inspector and Author use published core 0.37.1 with the matching renderer, editor and PPTX packages, and register the Gallery 0.26 catalog for validation, preview and export. The toolkit proof reports the installed runtime versions.
OPF 0.23 added color variants. design.variant, on the deck or on one slide, remaps the deck's one color scheme the way PowerPoint's Variants gallery does: light1, light2, dark1 or dark2, or { "background": "dark1", "accents": [...] } to reorder the six accents. The gallery (since 4.0) therefore has no dark theme: a dark deck is a theme with a dark variant, such as { "theme": "classic", "variant": "dark1" }. Picture and gradient backgrounds take a tone (dark or light) that picks the map for them, and the neutrals (borders, gridlines, chart text, code panels) derive from the scheme.
Document Structure
An OPF document is one JSON object; only slides is required. Everything else is optional and is resolved from the document itself, then from the catalogs the host registers:
{
"$schema": "https://openpresentation.org/schema/opf/v1",
"name": "Q3 Business Review",
"language": "en-US",
"audience": ["executive"],
"tone": "formal",
"design": { "theme": "minimal", "imageFit": "cover" },
"slides": [ ... ],
"catalogs": { "default": { "source": "https://www.pptx.gallery", ... } }
}rootrequiredIdentity, intent, appearance and resources. Only slides is required; names are plain, there is no meta wrapper.
slides*namedescriptionaudiencepurpose / tone / narrativelanguagedesigncatalogsassets / variables / datasetsdesignVisual design. Each field is a catalog reference, an inline override or a value. Shared layout defaults use the slide's design, then the deck's, then the theme's, then the layout's, then the engine default.
themecolorScheme / fontSchemevariantdimensionsbackgroundimageFitheader / footer / logo / watermarkSlides
A slide has a title, optional subtitle, notes and a layout reference, plus its content in the loosest of three shapes: a payload on the slide itself, an ordered blocks array (groups nest), or blocks that name a cell of the slide's grid with region when position matters (on a slide without a layout). Engines own placement; there is no x or y.
{
"id": "revenue",
"layout": "two-column",
"section": "Financial overview",
"title": "Revenue grew 34% year over year",
"blocks": [
{ "items": ["Enterprise seats up 31%", "Churn down to 2.1%"] },
{ "chart": { "type": "column", "data": { "columns": ["Quarter", "Revenue"], "rows": [["Q1", 12], ["Q2", 19]] } } }
],
"notes": "Revenue grew 34% YoY driven by enterprise expansion."
}text / items / bulletsRich text runs, lists with levels and numbering; an entry can carry an icon such as lucide:rocket
imageA picture with fit, focus, any preset shape as a mask (with adjust), a stroke, opacity, recolor, overlay and edge placement
shapeOne of PowerPoint's 187 preset shapes or a custom path, with fill, stroke, effects and text inside; native shapes in PPTX
chartColumn, bar, line, pie, area, scatter, combo and more (the schema lists the chart types)
tableRows of scalars, text runs or styled cells with spans, and an alt text that says what the table shows
metric / quote / timelineKPIs with trend, sentiment and an icon, quotes with a role and photo, timeline events with status
code / videoHighlighted code, embedded video with a poster
diagramMermaid source drawn in the deck's own fonts and colors (flowcharts, sequences, ER, Gantt and more); native shapes in PPTX
groupA nested block list with its own composition and an optional icon
slide shapesOverlay shapes and connectors on top of the slide, placed by fractions or attached to a block; connectors follow what they join
Layouts: one list of regions
A layout is one ordered list of regions, declared once, in reading order. Each region says how much of the slide it takes, which content it accepts and how several blocks share it. The list has a direction: row puts the regions side by side, left to right; column (the default) stacks them top to bottom.
A story on the left and the evidence beside it, a third of the width:
{
"id": "story-and-evidence",
"name": "Story and evidence",
"direction": "row",
"anchor": "middle",
"regions": [
{ "name": "main", "size": 2, "accepts": ["text"] },
{ "name": "aside", "size": 1, "accepts": ["metric"] }
]
}Read it left to right, because the record's direction is row: main first, then aside, and main is twice as wide. The anchor is written once and applies to both regions. A block targets a region by name ("region": "aside"); other blocks bind to regions by kind, role and the order of the list.
For two dimensions, an entry of the list is a split: a nested list that runs the other way. A title above a row of two regions, the most common shape in the gallery:
{
"name": "Two column",
"regions": [
{ "name": "title" },
{ "direction": "row", "regions": [
{ "name": "first", "accepts": ["text", "list"] },
{ "name": "second", "accepts": ["text", "list"] }
] }
]
}regionsholds 1 to 12 entries, each a region (name, an optionalsizeand its rules) or a split (direction,regionsand an optional size). Splits nest up to three levels, and every region name is unique in the record.sizeis a number above 0 and up to 100 (default 1). Siblings share their parent's length in proportion, so2and1are two thirds and one third."auto"takes the height the content needs and is allowed only inside a column.titleandsubtitleare reserved heading regions. A layout with notitleregion gets an automatic title row on top for a slide that has headings.- A region's rules are
accepts(every body content kind when omitted),role,flow,max,bleed,anchorandempty.anchorwritten on the record or on a split applies to every body region under it that does not set its own.
Layouts used to be a grid (areas, columns, rows and a regions map). Core and the engines no longer read that form. Inspector and Author repair it when they open something saved earlier (a share link, an autosave, a saved Author document, an imported file, a gallery source): a copy of a Gallery layout is refreshed from the current Gallery record, and a custom layout is converted when the grid can be cut by straight lines across the slide. One that cannot is named, with what to rewrite. A deck saved before OPF 0.35 is brought to the 0.35 form in the same places with core's safe fixes, and the 0.35 engine draws it; the notice names the fixes that can change how a slide looks and the slides to check. The REST API validates what you send as it is and reports the old form as a layout finding.
Catalogs and saved documents
A catalog is a set of reusable records: layouts, themes, color schemes, font schemes, narratives, audiences, purposes and tones. The default catalog is published by pptx.gallery. A document groups the records it embeds by the catalog they came from; inside a group they are keyed by kind and then by id.
"design": { "theme": "acme:brand" },
"catalogs": {
"default": {
"source": "https://www.pptx.gallery",
"layouts": { "two-column": { "name": "Two column", "regions": [{ "name": "title" }, { "direction": "row", "regions": [{ "name": "first" }, { "name": "second" }] }] } }
},
"acme": { "source": "pkg:@acme/opf-catalog", "themes": { "brand": { "colorScheme": "ocean" } } },
"custom": { "layouts": { "q4-special": { "name": "Q4 special", "regions": [{ "name": "body", "accepts": ["text"] }] } } }
}defaultis where bare ids come from;customholds records the document defines itself; any other name is an extra catalog and the prefix of its references (acme:brand)."default": falsemeans no catalog fallback at all.- A group's
sourceidentifies a catalog (a URL orpkg:package name). Nothing is fetched: the host registers catalogs by their source, and pptx.dev registers the default catalog inlib/opf-catalogs.ts. - A bare id resolves in
custom, then the records underdefault, then the registered default catalog;name:idresolves in that group, then in the catalog registered for its source. A reference that resolves nowhere is anopf/unresolved-referencewarning and the engine default applies; a prefix no group declares is an error. - A layout is one ordered list of named
regions, each with its size, accepted content kinds, role and flow (see Layouts). The renderer routes authored content into those regions. Nested content groups remain explicit content; selecting a template preserves content and changes only the layout reference. - A region's
arrangementdraws a list as a diagram: thepyramid,matrix,cycle,chevrons,processandvertical-processlayouts use it ({ "layout": "pyramid", "items": ["Vision", "Goals", "Programs"] }). The PPTX export writes PowerPoint's design as live SmartArt where PowerPoint lays it out as the preview draws it, otherwise as native shapes. - A template's
designsupplies defaults using the same fields as deck and slide design: alignment, content cards, title position, image fit, list markers and mirroring. For example,titlePosition: "start"puts the title beside the body, andlistBullet: "image"uses the deck's icon logo for list markers. A slide can override a template default with the same design field. - Every download, export, share link, account save and API output embeds the records a document uses with core's
embed(the CLI does the same:opf embed in.opf.json out.opf.json), so a saved document renders the same in any engine, offline, with no catalog registered. Catalog display metadata (x-*) is stripped on the way in.
Backgrounds and images
A background is the only canvas fill and never moves content; a full-bleed photo is an image background. Every content picture is an image block, and an edge placement lets it bleed to one edge while the title and content compose in the remaining space.
{ "title": "Shipping, rebuilt",
"design": { "background": {
"type": "image", "src": "./images/harbour.jpg", "alt": "Container ships at dawn",
"focus": { "x": 0.5, "y": 0.7 }, "overlay": { "color": "dark1", "opacity": 0.4 } } } }
{ "title": "Where we ship",
"blocks": [
{ "image": { "src": "./images/routes.png", "alt": "Shipping routes" },
"fit": "contain", "placement": { "edge": "end", "size": 0.45 } },
{ "text": "Twelve ports, three continents" } ] }Three Ways to Provide Design Choices
1. Reference pptx.gallery
Use named records from the curated gallery at pptx.gallery. Browse themes, color schemes, font pairings, layouts and narrative templates; a reference is the record's id.
"design": { "colorScheme": "cool-horizon", "fontScheme": "aptos" }2. Custom, validated JSON
Override single slots inline, or define a whole record under catalogs.custom. Use the JSON Schema at https://openpresentation.org/schema/opf/v1 for IDE autocomplete and CI validation.
"design": { "colorScheme": { "id": "cool-horizon", "accent1": "#e94560" } }3. Edit locally in Author
In Author, import OPF or PowerPoint, edit text on the canvas, and undo or export changes without an account. Exported PowerPoint text is real text, but body text is one text box per wrapped line, so it matches the preview and does not reflow when you edit it in PowerPoint or Keynote; a native body mode is an opt-in bodyText: "native" export option of @openpresentation/opf-pptx (native body prototype). Opening OPF's PPTX in LibreOffice Impress is experimental; OPF checks it nightly in LibreOffice 26.8 on Linux. With OPF's open fonts, or a typefaces: "safe" export, text, lists, images, tables and common charts open complete and inside their boxes. Treemap, waterfall, funnel and box-and-whisker charts need charts: "picture". A gallery pick writes the reference and embeds the record it names. Hosted generation from prompts and source material is optional; the resulting OPF stays visible and editable.
Import → preview → edit → undo → exportMarkdown
OPF has a small Markdown dialect for people and LLMs. It is a format, not a new schema: Markdown converts to the same JSON, and any valid OPF document converts back to Markdown. JSON stays the canonical form. The converters are @openpresentation/opf/markdown in core, the same code behind opf convert (its Markdown input and output) and behind the JSON / YAML / Markdown toggle in the playground. The canonical guide, with every rule and diagnostic, is openpresentation.org/docs/markdown.
--- name: Q3 Business Review language: en-US --- <!-- slide: id=cover layout=title section=Overview --> # Q3 Business Review ## Operations and growth Note: Two minutes on the agenda, then straight into the numbers. --- # Revenue grew every quarter ```chart column Quarter,Revenue Q1,12 Q2,18 ``` > We would rather spend a week on capacity than a month on an outage. > — Priya Raman, Head of Platform
The dialect
- Deck: YAML front matter between two
---lines holds every deck property exceptslides(name,language,design, ...). It is JSON-compatible YAML: no anchors or tags. - Slides: a line of
---starts the next slide.# Titleis the slidetitleand## Subtitlethesubtitle.Note: ...(orNotes:) starts the speaker notes, which run to the next slide. - Slide options: one
<!-- slide: id=cover layout=title section="Part 1" tag=NEW hidden beat=a -->comment per slide setsid,layout,section,tag,hidden,beatandtype. Other Markdown viewers ignore it. - Blocks: paragraphs become
text(with**bold**,*italic*, links),- itemsa list,> quotea quote with an— attributionline, pipe tables atable,an image and a fenced block with a language acodeblock. - Data fences:
```chart column(CSV with a header row, or a JSON object),```metric(value:,label:,delta:, ...) and```timeline(Q1 — Pilot, one event per line). A```mermaidfence is adiagram; addalt="..."to the fence line for its alt text (see the diagrams guide). - Block options: a
<!-- block: id=kpi as=bullets -->comment directly before a block gives it anid, stores a list asbullets, or names itsregion(a region of the layout, or a cell of the slide's grid).
Escape hatches and round trips
Whatever the dialect has no syntax for (a design, nested groups, a table of numbers) is written as YAML in a fenced block, so nothing is lost: an opf-slide fence merges extra slide fields, and an opf-block fence holds any content block.
```opf-block
id: arr
table:
columns: [Segment, ARR, Growing]
rows:
- [Enterprise, 42, true]
- [Growth, 7, false]
```
The Markdown the writer produces converts back to the same deck, and to itself byte for byte. Hand-written Markdown may be rewritten into an equivalent canonical form (a single block becomes a root field, shorthand and object forms collapse to the shorter one). Errors carry the line and column of the Markdown that caused them; warnings, such as a demoted ### heading, never block. In the playground, switching to Markdown shows the first error with its line and column when the text is not valid.
From the command line: opf convert deck.md deck.opf.json and opf convert deck.opf.json deck.opf.md (0.18; before it, opf from-md and opf to-md). Since 0.16 a file named deck.opf.md is a Markdown deck that every CLI command reads and writes like a JSON one (validate, convert, edit, format, embed and the rest): the name decides, the content is never sniffed, and a plain .md file is a deck only as the input of opf convert. A Markdown syntax error exits with its line and column. In code, core's parse(text, { filename }) and stringify(presentation, { filename }) (0.16 named them readDeck and writeDeck) do the same for JSON, YAML and Markdown; parse returns the deck and throws OPFValidationError, with the line and column of each finding, on a syntax, schema or reference error. A table with an alt has no pipe-table syntax, so the writer emits it as an opf-block. The older pptx.dev dialect ( ## Title {id=...} headings and opf-element fences) is retired and is no longer read.
Read, write and export from code
Core's root import, @openpresentation/opf, carries the file API in Node: the simple path when an application converts, opens and saves OPF files, and exports or imports a PowerPoint file, without spawning opf. opf convert and the other file commands run the same code, so the bytes match the command's. In 0.17 this was @openpresentation/opf/node, which 0.18 removes; before 0.17 it was @openpresentation/cli/api.
import * as opf from "@openpresentation/opf"
await opf.convert("deck.opf.md", "deck.pdf") // also .pptx, .png (one per slide), .svg, .zip and the deck forms
await opf.convert("deck.pptx", "deck.opf.yaml") // PowerPoint to OPF
const deck = await opf.open("deck.opf.md") // .opf.md, .yaml, .yml or .json, or a .pptx to import
deck.slides.push({ title: "Q4" })
await opf.save(deck, "deck.opf.md") // the extension names the form
const { files, findings } = await opf.convert(deck, { format: "pptx" }) // no output path: nothing is written, files: [{ name, type, bytes }]The output's extension names the format (.pdf, .pptx, .png, .svg, .zip, .opf.md, .yaml, .yml or .json); a PNG or SVG output writes one file per slide (slides/deck.png gives slides/deck-001.png, and so on). Everything is produced before anything is written, each file atomically. The options are the opf convert flags in camel case (slides, scale, raster, text, charts, images, fonts, name; 0.17's pdfMode, svgFonts, chartex, imageFormat, fontDirs and filename are refused). An import is a conversion, not a lossless round trip (what it cannot keep is in findings), and an invalid deck throws OPFValidationError. The call is deterministic: no network, no system fonts, no clock. The same import has the rest of core (validate, parse, stringify, ingest, fill, edit and the types). In a browser or a worker it resolves to a browser-safe build with the same names, whose file functions reject with node-only; gallery is exported by @openpresentation/gallery.
What to install
From 0.16 the renderer's converters and font packages are optional peers, loaded on first use, so an SVG-only install holds none of them. Add what you export:
- SVG in a browser or in Node:
@openpresentation/opf-render/svg, nothing else. - PNG in Node (
@openpresentation/opf-render/png):@resvg/resvg-js, plussharpfor WebP and rotated JPEG pictures. - PDF in Node (
@openpresentation/opf-render/pdf):sharpfor pictures;pdf-liband@resvg/resvg-jsforraster: true. - Exact text measurement: the font packages of the pack you load (
@expo-google-fonts/robotoandroboto-monofor the base pack;arimo,caladea,cousine,gelasio,tinosandnoto-sanstoo for the office pack), pinned to the versions the renderer lists. - PNG and PDF in a page:
@openpresentation/opf-render/export-browserneeds none of these.
A missing converter rejects with the error code converter-missing (core's convert reports peer-not-installed when opf-render or opf-pptx, its optional peers, are missing), and the message carries the install command. pptx.dev installs all of them for its Node deployment; the Cloudflare build has no native addons (see docs/cloudflare.md).
JSON Schema
The full JSON Schema is published at https://openpresentation.org/schema/opf/v1. Use it for editor autocomplete, CI validation, or building custom tooling.