Skip to content

feat: template-level shell defaults and structured attributes - #42

Merged
atherdon merged 1 commit into
mainfrom
feat/template-level-shell-defaults
Oct 15, 2026
Merged

atherdon merged 1 commit into
mainfrom
feat/template-level-shell-defaults

Conversation

@atherdon

Copy link
Copy Markdown
Contributor

Cycle 3: specialized document shapes can be declared once on the template, and attributes can be supplied as a structured map instead of only a raw string.

Changes

  • htmlAttributes and bodyAttributes accept either a raw string or a Record (boolean true emits a bare attribute; false/null/undefined are omitted). Values stay raw, matching the package policy.
  • openTag / serializeAttributes handle both shapes.
  • EmailTemplate gains an optional shell?: DocumentShellOptions. defineEmailTemplate stores it and composeEmail merges it with per-render props (props win).
  • Tests cover structured attributes and template-level defaults with override.
  • Public exports include TagAttributes, openTag, and serializeAttributes.

A Postmark-style template can now set its XHTML doctype, xmlns, and body styles once on the template definition. Per-render props can still override any of them. Defaults for ordinary HTML5 emails are unchanged.

This branch includes the earlier document-shell and email-forwarding commits.

- htmlAttributes / bodyAttributes accept a raw string or a structured map.
- openTag / serializeAttributes handle both shapes (raw interpolation).
- EmailTemplate.shell holds default DocumentShellOptions; per-render
  props override them.
- composeEmail merges the two and forwards the result to document().

A Postmark-style or styled-body template can declare its shape once.
@github-actions

Copy link
Copy Markdown

Rendered emails

This PR rendered email templates.

Open the run → Artifacts → download → open index.html.

@atherdon
atherdon merged commit ab6c2d5 into main Oct 15, 2026
6 of 7 checks passed
@atherdon
atherdon deleted the feat/template-level-shell-defaults branch October 15, 2026 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant