Home

Email Theme Target

Overview

When Stencila renders email output, theme tokens are converted into MJML attributes and CSS rules, then compiled to HTML suitable for email clients. Theme values are computed with pixel conversion so layout values remain consistent across email clients.

This translation happens whenever you create email-ready HTML with Stencila, for example using the CLI's render command:

stencila render report.smd report.email.html

Token Mapping

The email encoder focuses on typography and component-level styling that can be safely represented in email HTML.

Core Typography

TokensEmail output
--text-font-family<mj-all font-family>
--text-color-primary<mj-all color> and base text color
--text-font-size<mj-text font-size> (px)
--text-line-heightBase line-height for body and paragraphs
--text-color-secondarySecondary text color (authors, abstract, metadata)
--text-color-mutedMuted text color for supporting text

Headings

TokensEmail output
--heading-font-familyHeading font family
--heading-colorHeading color
--heading-line-heightHeading line-height
--heading-letter-spacingHeading letter spacing
--heading-font-weightHeading font weight
--heading-font-size + --heading-font-size-ratioh1-h6 font sizes

Links

TokensEmail output
--link-colorLink color
--link-decorationLink underline style
--link-color-hoverHover color (where supported)

Code, Quotes, and Tables

TokensEmail output
--code-font-family, --code-color, --code-background, --code-border-color, --code-border-radius, --code-line-heightInline and block code styles
--quote-background, --quote-border-width, --quote-border-color, --quote-font-style, --quote-paddingBlock quote styling
--table-border-color, --table-header-background, --table-header-font-weight, --table-cell-paddingTable borders, headers, and cell padding

Work Metadata

TokensEmail output
--work-title-*Title font family, size, weight, color, alignment
--work-authors-*Author font size, color, alignment, spacing
--work-abstract-*Abstract font size, color, alignment, background

Lists and Surfaces

TokensEmail output
--list-indent, --list-item-spacing, --list-marker-colorList indentation, spacing, marker color
--surface-backgroundBody background color
--border-color-defaultDivider and border defaults
--border-radius-defaultRounded corners for abstract callouts

Implementation Notes

  • Theme variables are computed with pixel conversion in encode_theme.rs.

  • The MJML/HTML encoder only uses tokens that are reliable in email clients.

  • For full token usage, see encode_theme.rs.

© 2026 Stencila