JDFJDF/ docs

Element reference

Every element on a page has a type field. Below is every type, every property, and a minimal example.

Every element accepts these common positioning fields:

FieldTypeDefault
position{x, y} in mm (or doc unit)flow with previous
widthnumbercontent area width
heightnumberauto-size
styleStyleRef

text

A paragraph or heading with single styling.

FieldTypeRequired
type"text"yes
contentstringyes
headingtrue or 1..6no — turns the element into <h1><h6>
align"left" · "center" · "right" · "justify"no
tocEntrystringno — text used in TOC instead of content
tocLevel1..6no — TOC nesting depth
linkstring or {type, target}no
{ "type": "text", "content": "Section 1", "heading": 2, "style": "h2" }

richtext

Inline-formatted text. A list of runs, each with its own styling.

FieldType
type"richtext"
runsarray of RichTextRun

Each run accepts: text, bold, italic, underline, strikethrough, color, fontSize, fontFamily, style, link.

{ "type": "richtext", "runs": [
  { "text": "This is " },
  { "text": "bold", "bold": true },
  { "text": " and " },
  { "text": "colored", "color": "#dc2626" },
  { "text": " and " },
  { "text": "linked", "link": "https://example.com" }
] }

image

FieldType
type"image"
resourcestring — key into resources.images
srcstring — URL, file path, or data: URI
altstring
fit"contain" · "cover" · "fill" · "none"
linksame as text
{ "type": "image", "resource": "hero", "width": 120, "height": 80, "fit": "cover" }
{ "type": "image", "src": "https://cdn.example.com/logo.png" }

table

FieldType
type"table"
headersarray of strings
columnsarray of {header, width, align}
rows2D array — each cell is a string or {content, colspan, rowspan, style}
bordersboolean or {outer, inner, color, width}
alternatingRowColorcolor string
alternateRowStyleStyleRef
headerStyle / rowStyleStyleRef
{ "type": "table",
  "headers": ["Quarter", "Revenue", "YoY"],
  "borders": { "outer": true, "inner": true, "color": "#e2e8f0" },
  "alternatingRowColor": "#f8fafc",
  "columns": [{ "align": "left" }, { "align": "right" }, { "align": "right" }],
  "rows": [
    ["Q1", "$2.3M", "+12%"],
    ["Q2", "$2.7M", "+15%"]
  ] }

list

FieldType
type"list"
listType"ordered" · "unordered" (default "unordered")
itemsarray of {content, listType?, children?}

Items can have nested children (recursive). A child item with its own listType overrides the parent's type for that subtree.

{ "type": "list", "listType": "unordered", "items": [
  { "content": "First" },
  { "content": "Second", "children": [
    { "content": "Nested A" },
    { "content": "Nested B" }
  ] },
  { "content": "Third" }
] }

shape

FieldType
type"shape"
shape"rect" · "circle" · "ellipse" · "line" · "path"
fillcolor string
strokecolor string or {color, width}
strokeWidthnumber
borderRadiusnumber (rect only)
pathSVG d string (path only)
{ "type": "shape", "shape": "rect", "fill": "#3b82f6",
  "width": 60, "height": 40, "borderRadius": 8 }

collapsible

FieldType
type"collapsible"
titlestring
elementsarray of any element
expandedboolean — initial state (default false)
{ "type": "collapsible", "title": "Click to expand",
  "expanded": false,
  "elements": [
    { "type": "text", "content": "Hidden content here" }
  ] }

toc

Auto-generated from headings on every page. Click an entry to navigate to that page.

FieldType
type"toc"
depthinteger 1-6 — max heading level to include (default 6)
{ "type": "toc", "depth": 3, "width": 166 }

Style properties

Both inline element style and named styles entries accept these CSS-like properties:

PropertyType / values
fontFamilystring
fontSizenumber (points)
fontWeight"normal" · "bold" · "100"…"900"
fontStyle"normal" · "italic"
colorcolor string (hex)
backgroundColorcolor string
textAlign"left" · "center" · "right" · "justify"
textDecoration"none" · "underline" · "line-through" · "strikethrough"
lineHeightnumber
letterSpacingnumber (px) or string
padding / marginnumber, string, or {top, right, bottom, left}
marginTop / marginBottomnumber
borderstring (CSS-like)
borderRadiusnumber or string
opacitynumber 0..1