Private betav0.3.0
DocsSign in
Format developer documentation

HTML reference

The full HTML form of every document model type: tag, how Format identifies it, placement, and attributes.

The canonical HTML form of every document model type: tag, how Format identifies it, fields, and placement.

Useful

Who uses this

Use this page when you author Format's HTML directly, build tools that emit or consume the model (codegen, validators, LLM document generators), or inspect the HTML the SDKs render. Most React and Vue components map onto a type here, but the match is not total: Frame is a data-type="frame" attribute you add to your own element rather than a component, and PageBreak renders a bare marker template. The TypeScript definitions for @format.dev/react and @format.dev/vue are authoritative for the component props; this page is authoritative for the underlying HTML.

How elements are classified

When Format parses your HTML, every model type is identified by its data-type attribute. A <template data-type="layout"> is a Layout, a <template data-type="flow"> is a Flow, a <template data-type="stream"> is a Stream, a <div data-type="frame"> is a Frame, and the shared <template> markers carry the data-type that names them.

Placement does not change classification: a <template data-type="layout"> is a Layout wherever it sits in your document, and a generic <template> with no matching data-type stays plain markup.

A hand-authored document must also set data-engine on its root <template data-type="document">, naming the engine version Format renders it on. See Document versions.

When the SDK and the schema disagree

The React and Vue SDKs sometimes narrow the accepted types. Two examples:

  • The React <Layout width={...} /> prop takes a number; the underlying data-width is a CSS px-length string, and the SDK adds the px suffix.
  • A React <Flow splitGranularity="sentence"> prop takes a string literal type; the underlying data-split-granularity is the same string with the same value.

The TypeScript definitions for @format.dev/react and @format.dev/vue are authoritative for the component props. The schema here is authoritative for the underlying HTML form. When your tool emits the HTML directly (LLM document generators, server-side template engines), match the schema; when you work through the SDK, write against the TypeScript definitions.

Validating against the schema

The full schema lives at model.schema.json in the @format/engine package. It uses JSON Schema draft 2020-12. You can validate rendered HTML against it programmatically, which catches malformed documents in CI before they reach Format.

Document model · Errors · Pagination

Types

Bookmarks

Tag: <template> · Identified by data-type="bookmarks"

Placement: Direct child of Document

AttributeFieldFormatRequired
data-numbersnumbersboolean—
data-separatorseparatorstring—

Counter

Tag: <span> · Identified by data-type="counter"

Placement: Anywhere within Flow

AttributeFieldFormatRequired
data-namenamestring✓
data-actionactionenum variant—
data-valuevalueinteger—
data-joinjoinstring—
data-counter-stylecounterStylestring—

CounterDef

Tag: <template> · Identified by data-type="counter-def"

Placement: Direct child of Numbering

AttributeFieldFormatRequired
data-namenamestring✓
data-reset-eachresetEachstring—

Document

Tag: <template> · Identified by data-type="document"

Placement: Top-level

AttributeFieldFormatRequired
data-titletitlestring✓
data-subjectsubjectstring—
data-authorauthorstring—
data-keywordskeywordsstring—
data-langlangstring—
data-fontsfontsenum variant—

Flow

Tag: <template> · Identified by data-type="flow"

Placement: Anywhere within Layout or Frame or Flow

AttributeFieldFormatRequired
data-split-granularitysplitGranularityenum variant—
data-pagination-strategypaginationStrategyenum variant—
data-scopescopestring—

Footnote

Tag: <template> · Identified by data-type="footnote"

Placement: Anywhere within Flow

No attributes.

Footnotes

Tag: <template> · Identified by data-type="footnotes"

Placement: Anywhere within Layout or Flow

AttributeFieldFormatRequired
data-counter-stylecounterStylestring—
data-restart-each-pagerestartEachPageboolean—
data-repeat-headrepeatHeadboolean—

Frame

Tag: any element with layout · Identified by data-type="frame"

Placement: Anywhere within Layout

AttributeFieldFormatRequired
data-ididstring✓

Layout

Tag: <template> · Identified by data-type="layout"

Placement: Direct child of Document

AttributeFieldFormatRequired
data-ididstring✓
data-widthwidthCSS px length✓
data-heightheightCSS px length✓
data-pagination-strategypaginationStrategyenum variant—
data-split-granularitysplitGranularityenum variant—

Numbering

Tag: <template> · Identified by data-type="numbering"

Placement: Direct child of Document

AttributeFieldFormatRequired
data-counter-stylecounterStylestring—
data-default-headingsdefaultHeadingsboolean—

NumberingRule

Tag: <template> · Identified by data-type="numbering-rule"

Placement: Direct child of Numbering

AttributeFieldFormatRequired
data-matchselectorstring✓
data-countercounterstring—
data-incrementincrementinteger—
data-setsetinteger—
data-formatformatstring—
data-counter-stylecounterStylestring—
data-insertinsertenum variant—

PageBreak

Tag: <template> · Identified by data-type="page-break"

Placement: Anywhere within Flow

No attributes.

Ref

Tag: <span> · Identified by data-type="ref"

Placement: Anywhere within Flow

AttributeFieldFormatRequired
data-totoid reference✓
data-countercounterstring—
data-pagepageboolean—
data-counter-stylecounterStylestring—

RunningHead

Tag: <span> · Identified by data-type="running-head"

Placement: Anywhere within Layout or Flow

AttributeFieldFormatRequired
data-matchselectorstring✓
data-showshowenum variant—
data-withinwithinstring—
data-formatformatstring—
data-counter-stylecounterStylestring—
data-range-separatorrangeSeparatorstring—

Stream

Tag: <template> · Identified by data-type="stream"

Placement: Anywhere within Flow

No attributes.

TableOfContents

Tag: <template> · Identified by data-type="toc"

Placement: Anywhere within Flow

AttributeFieldFormatRequired
data-collectcollectstring—
data-leaderleaderenum variant✓
data-repeat-headrepeatHeadboolean—
data-withinwithinstring—
Was this page helpful?