Skip to content

Element Types Reference

Complete reference for all element types available in structured headers and footers.

Overview

TypeDescriptionPrimary Property
textStatic or dynamic textcontent
imageEmbedded imagesrc
dateFormatted date/timeformat
titleDocument titlefallback
page_numberCurrent pageformat
total_pagesTotal pagesformat
spacerFlexible/fixed spacewidth

text

Display static text or dynamic content with placeholders.

Properties

PropertyTypeRequiredDescription
type"text"Element type
contentstringText content with placeholders
font_sizestringCSS font-size
font_weightstring | numberCSS font-weight
font_stylestringCSS font-style (normal, italic, oblique)
colorstringCSS color
stylestringAdditional inline CSS

Examples

json
// Simple text
{ "type": "text", "content": "Confidential" }

// With placeholder
{ "type": "text", "content": "Author: {author}" }

// Page numbers
{ "type": "text", "content": "Page {page} of {pages}" }

// Styled
{
  "type": "text",
  "content": "DRAFT",
  "font_size": "12px",
  "font_weight": "bold",
  "color": "red"
}

// With custom CSS
{
  "type": "text",
  "content": "Important",
  "style": "text-transform: uppercase; letter-spacing: 2px;"
}

image

Embed an image (SVG, PNG, or JPG). Images are converted to base64 data URIs.

Properties

PropertyTypeRequiredDescription
type"image"Element type
srcstringPath to image (relative to Markdown file)
heightstringCSS height ("12mm", "20px")
widthstringCSS width (usually omit for aspect ratio)
altstringAlt text for accessibility
stylestringAdditional inline CSS

Supported Formats

  • SVG (.svg) — Recommended for logos, scales perfectly
  • PNG (.png) — Good for images with transparency
  • JPEG (.jpg, .jpeg) — Good for photos

Examples

json
// Basic logo
{ "type": "image", "src": "./logo.svg", "height": "15mm" }

// With alt text
{
  "type": "image",
  "src": "./images/logo.png",
  "height": "12mm",
  "alt": "Company Logo"
}

// Fixed width
{ "type": "image", "src": "./icon.svg", "width": "20mm" }

date

Display a formatted date or time using date-fns patterns.

Properties

PropertyTypeRequiredDescription
type"date"Element type
formatstringdate-fns format (default: "yyyy-MM-dd")
font_sizestringCSS font-size
font_weightstring | numberCSS font-weight
colorstringCSS color
stylestringAdditional inline CSS

Common Formats

FormatExample Output
yyyy-MM-dd2025-06-14
MMMM d, yyyyJune 14, 2025
MM/dd/yyyy06/14/2025
dd.MM.yyyy14.06.2025
d MMMM yyyy14 June 2025
EEE, MMM dSat, Jun 14
HH:mm14:30

See Date Formats for complete reference.

Examples

json
// ISO date (default)
{ "type": "date" }

// US format
{ "type": "date", "format": "MMMM d, yyyy" }

// European format
{ "type": "date", "format": "d MMMM yyyy" }

// With time
{ "type": "date", "format": "yyyy-MM-dd HH:mm" }

// Styled
{
  "type": "date",
  "format": "MMMM d, yyyy",
  "font_size": "8px",
  "color": "#666"
}

title

Display the document title from front matter, H1, or filename.

Properties

PropertyTypeRequiredDescription
type"title"Element type
fallbackstringText if no title found
font_sizestringCSS font-size
font_weightstring | numberCSS font-weight
font_stylestringCSS font-style
colorstringCSS color
stylestringAdditional inline CSS

Title Resolution Order

  1. title field in YAML front matter
  2. First H1 heading in the document
  3. Filename (without extension)
  4. fallback value (if specified)

Examples

json
// Basic
{ "type": "title" }

// With fallback
{ "type": "title", "fallback": "Untitled Document" }

// Styled
{
  "type": "title",
  "font_weight": "bold",
  "font_style": "italic",
  "color": "#2c3e50"
}

page_number

Display the current page number. Rendered by Chromium at print time.

Properties

PropertyTypeRequiredDescription
type"page_number"Element type
formatstringFormat with {page} placeholder
font_sizestringCSS font-size
colorstringCSS color
stylestringAdditional inline CSS

Examples

json
// Just the number
{ "type": "page_number" }

// With prefix
{ "type": "page_number", "format": "Page {page}" }

// Styled
{
  "type": "page_number",
  "format": "- {page} -",
  "font_size": "8px",
  "color": "#999"
}

total_pages

Display the total number of pages. Rendered by Chromium at print time.

Properties

PropertyTypeRequiredDescription
type"total_pages"Element type
formatstringFormat with {pages} placeholder
font_sizestringCSS font-size
colorstringCSS color
stylestringAdditional inline CSS

Examples

json
// Just the number
{ "type": "total_pages" }

// With text
{ "type": "total_pages", "format": "of {pages}" }

TIP

For "Page X of Y" format, use a text element:

json
{ "type": "text", "content": "Page {page} of {pages}" }

spacer

Add flexible or fixed space between elements in a zone.

Properties

PropertyTypeRequiredDescription
type"spacer"Element type
widthstringFixed width; omit for flexible (flex: 1)

Examples

json
// Flexible spacer (fills available space)
{ "type": "spacer" }

// Fixed width
{ "type": "spacer", "width": "15mm" }

Use Case

Push elements apart within a zone:

json
{
  "left": [
    { "type": "image", "src": "./logo.svg", "height": "10mm" },
    { "type": "spacer" },
    { "type": "text", "content": "Division Name" }
  ]
}

Common Styling Properties

Most elements support these properties:

PropertyTypeDescription
font_sizestringCSS font-size ("9px", "10pt")
font_weightstring | numberCSS font-weight ("bold", 600)
font_stylestringCSS font-style ("normal", "italic")
colorstringCSS color ("#333", "gray")
stylestringArbitrary inline CSS

style Property

The style property accepts arbitrary CSS:

json
{
  "type": "text",
  "content": "Notice",
  "style": "text-transform: uppercase; letter-spacing: 1px; text-decoration: underline;"
}

See Also

Released under the MIT License.