Emails in the Buttondown CLI are stored as Markdown files with YAML frontmatter, providing a clean and version-control-friendly format for your newsletter content.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/buttondown/cli/llms.txt
Use this file to discover all available pages before exploring further.
File Format
Each email file follows this structure:Frontmatter Fields
The frontmatter section (between the--- delimiters) contains metadata about the email. The CLI supports the following fields, defined in src/sync/emails.ts:41-57:
Core Fields
Unique identifier for the email. Set by Buttondown when the email is created. Required for updating existing emails.
The email subject line. This is what subscribers see in their inbox.
The type of email. Options:
public- Regular newsletter email (default)private- Subscriber-only contentpremium- Premium subscriber content
Publication status. Options:
draft- Not yet sentscheduled- Scheduled for future sendingpublished- Already sent to subscribers
URL-friendly identifier for the email. Used in web archives and for the filename when syncing.
When the email was or will be published. Format:
YYYY-MM-DDTHH:mm:ssZExample: 2024-01-15T10:00:00ZOptional Fields
A brief description of the email content. Used for SEO and previews.
Featured image URL for the email. Displayed in web archives and social shares.
Canonical URL if this email was originally published elsewhere.
Secondary identifier for the email, if needed for external systems.
Custom metadata as key-value pairs. Useful for storing additional data.
Whether this email should be featured in your archive.
Controls comments on the email. Options:
enabled- Comments allowed (default)disabled- Comments not allowed
Subscriber filters for targeted sending.
Array of related email IDs.
Email Body
The content after the second--- delimiter is the email body, written in Markdown.
Supported Markdown
Buttondown supports standard Markdown syntax:- Headers:
# H1,## H2,### H3 - Bold:
**bold text** - Italic:
*italic text* - Links:
[link text](https://example.com) - Images:
 - Lists: Both ordered (
1. Item) and unordered (- Item) - Code: Inline
`code`and code blocks - Blockquotes:
> Quote
Image References
The CLI handles image references in a special way to support local development:Relative Paths (Local)
When working locally, reference images using relative paths:Absolute URLs (Remote)
When pushing to Buttondown, the CLI automatically converts relative paths to absolute URLs:You don’t need to manually convert between relative and absolute paths. The CLI handles this automatically during push and pull operations.
Serialization and Deserialization
The CLI includes functions to convert between Buttondown API format and Markdown files.Deserialize (API → Markdown)
Fromsrc/sync/emails.ts:76-122, the deserialize function:
- Splits content by
---delimiters - Parses YAML frontmatter
- Extracts email body
- Validates required fields
Serialize (Markdown → API)
Fromsrc/sync/emails.ts:132-163, the serialize function:
- Separates frontmatter from body
- Filters out empty/default values
- Generates clean YAML
- Combines into final Markdown format
Default Values
The CLI omits fields with default values to keep files clean. Default values fromsrc/sync/emails.ts:59-71:
Creating New Emails
You can create email files in two ways:1. Using the CLI
2. Manual Creation
Create a new.md file in the emails/ directory:
Editing Emails
Edit email files directly in your favorite text editor:- Open the
.mdfile - Modify frontmatter fields or body content
- Save the file
- Run
buttondown pushto sync changes to Buttondown
Special Handling
Editor Mode Sigil
The CLI adds a special comment to email bodies when pushing to Buttondown:Image Path Conversion
The CLI automatically handles image path conversions:- Pull: Converts
https://buttondown.s3.amazonaws.com/images/abc123.png→../media/header.png - Push: Converts
../media/header.png→https://buttondown.s3.amazonaws.com/images/abc123.png
.buttondown.json (see Sync Workflow).