Skip to content

update mrml to 6.0.1 and enable inline styles - #38

Open
cristofercruz wants to merge 1 commit into
hardpixel:masterfrom
cristofercruz:move-to-mrml-6
Open

update mrml to 6.0.1 and enable inline styles#38
cristofercruz wants to merge 1 commit into
hardpixel:masterfrom
cristofercruz:move-to-mrml-6

Conversation

@cristofercruz

Copy link
Copy Markdown

Enable the css-inline feature so CSS in mj-style inline="inline" is merged into the style attributes of the elements it matches, which is what most email clients need. Plain mj-style tags keep rendering into a <style> tag in the head.

Templates that don't use the attribute are unaffected: mrml only runs the inliner when the header collected inline styles, and their output is byte-identical with and without the feature.

Also clone the parsed tree directly rather than reparsing to_mjml output. mrml's Printable impl for MjStyle doesn't emit the inline attribute, so the previous implementation silently dropped inlining from clone/dup. Cloning the struct also avoids a full reparse and an unwrap panic path.

Enable the css-inline feature so CSS in `mj-style inline="inline"` is merged
into the style attributes of the elements it matches, which is what most email
clients need. Plain mj-style tags keep rendering into a <style> tag in the head.

Templates that don't use the attribute are unaffected: mrml only runs the
inliner when the header collected inline styles, and their output is
byte-identical with and without the feature.

Also clone the parsed tree directly rather than reparsing to_mjml output.
mrml's Printable impl for MjStyle doesn't emit the inline attribute, so the
previous implementation silently dropped inlining from clone/dup. Cloning the
struct also avoids a full reparse and an unwrap panic path.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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