Skip to content

Placeholders Reference

Complete reference for all placeholders available in headers and footers.

Syntax

{placeholder}
{placeholder:format}

The :format suffix is optional and only applies to certain placeholders (like date).

Page Placeholders

Rendered by Chromium at print time — guaranteed accurate.

PlaceholderDescriptionHTML Output
{page}Current page number<span class="pageNumber"></span>
{pages}Total page count<span class="totalPages"></span>

Example

json
{
  "footer": {
    "center_text": "Page {page} of {pages}"
  }
}

Output: Page 3 of 10

Date & Time Placeholders

Resolved at export time using date-fns.

PlaceholderDefault FormatExample Output
{date}yyyy-MM-dd2025-06-14
{date:FORMAT}CustomSee below
{time}HH:mm:ss14:30:00
{datetime}yyyy-MM-dd HH:mm:ss2025-06-14 14:30:00

Date Format Examples

PlaceholderOutput
{date}2025-06-14
{date:yyyy-MM-dd}2025-06-14
{date:MMMM d, yyyy}June 14, 2025
{date:MM/dd/yyyy}06/14/2025
{date:dd/MM/yyyy}14/06/2025
{date:dd.MM.yyyy}14.06.2025
{date:d MMMM yyyy}14 June 2025
{date:EEE, MMM d}Sat, Jun 14
{date:EEEE, MMMM d, yyyy}Saturday, June 14, 2025
{date:Q}2 (quarter)
{date:yyyy}2025

Time Format Examples

PlaceholderOutput
{time}14:30:00
{date:HH:mm}14:30
{date:h:mm a}2:30 PM
{date:HH:mm:ss}14:30:00

Date-fns Format Tokens

TokenDescriptionExample
yyyy4-digit year2025
yy2-digit year25
MMMMFull monthJanuary
MMMAbbreviated monthJan
MM2-digit month01
MMonth number1
dd2-digit day05
dDay number5
EEEEFull weekdayMonday
EEEAbbreviated weekdayMon
HH24-hour hour14
hh12-hour hour02
mmMinutes30
ssSeconds45
aAM/PMPM
QQuarter2

Document Metadata Placeholders

PlaceholderSourceDescription
{title}Front matter title: or filenameDocument title
{author}Front matter author:Author name
{filename}File pathSource filename with extension

Example

yaml
---
title: Quarterly Report
author: Jane Smith
---
json
{
  "header": {
    "left_text": "{author}",
    "center_text": "{title}"
  }
}

Output: Jane Smith | Quarterly Report

Custom Variable Placeholders

Any field in front matter becomes a placeholder:

yaml
---
title: Project Report
company: Acme Corporation
department: Engineering
version: 2.0.0
project_code: PRJ-2025-001
client_name: BigCorp Inc.
fiscal_year: 2025
---

All are available as placeholders:

Front Matter FieldPlaceholder
company: Acme Corporation{company}
department: Engineering{department}
version: 2.0.0{version}
project_code: PRJ-2025-001{project_code}
client_name: BigCorp Inc.{client_name}
fiscal_year: 2025{fiscal_year}

Using Custom Variables

yaml
---
company: Acme Corp
version: 1.0.0
pdf:
  header:
    left_text: "{company}"
    right_text: "v{version}"
  footer:
    center_text: "Page {page} of {pages}"
---

Combining Placeholders

Multiple placeholders can be combined in a single text:

json
{
  "type": "text",
  "content": "{company} — {title} — {date:yyyy}"
}

Output: Acme Corp — Quarterly Report — 2025

json
{
  "type": "text",
  "content": "Generated {date:MMMM d, yyyy} at {date:HH:mm}"
}

Output: Generated June 14, 2025 at 14:30

Placeholder Resolution

Placeholders are resolved in this order:

  1. Page placeholders ({page}, {pages}) → Chromium spans
  2. Date/time placeholders → date-fns formatted strings
  3. Document metadata ({title}, {author}, {filename})
  4. Custom variables → From front matter
  5. Unknown → Left as-is (for debugging)

Case Sensitivity

Placeholder names are case-insensitive:

yaml
---
Company: Acme Corp
DEPARTMENT: Engineering
---

Both work as {company} and {department}.

Reserved Names

These names are reserved and have special handling:

NameType
pageChromium page number
pagesChromium total pages
dateCurrent date
timeCurrent time
datetimeCurrent date and time
titleDocument title
authorDocument author
filenameSource filename

Avoid using these as custom front matter field names.

Escaping

Currently, there is no escape syntax for literal curly braces. Avoid text that matches the {name} pattern unless you want placeholder substitution.

Troubleshooting

Placeholder Not Replaced

  1. Check spelling and case
  2. Verify front matter is valid YAML
  3. Ensure the field exists in front matter
  4. Check the debug log: /tmp/zed-markdown-pdf-debug.log

Date Format Invalid

If a date format is invalid, it falls back to ISO format (yyyy-MM-dd). Check the format string against date-fns documentation.

Unknown Placeholder Shows

Unknown placeholders are left as-is. This helps with debugging:

{compnay}  → {compnay}  (typo, not replaced)
{company}  → Acme Corp  (correct)

Released under the MIT License.