ferrum-email-render
The rendering engine for Ferrum Email.
What It Does
Takes a Component, calls its render() method, and produces:
- Email-safe HTML — all CSS inlined as
style=""attributes, HTML entities escaped, void elements self-closed - Plain text — extracted from the node tree with links as
text (url), images as[alt], and horizontal rules as---
Pipeline
Component::render() → Node tree
↓
CSS Inliner (Style structs → style="" attributes)
↓
HTML Emitter (Node tree → HTML string)
↓
Text Extractor (Node tree → plain text fallback)
Usage
use Renderer;
use Component;
let renderer = default;
let html = renderer.render_html.unwrap;
let text = renderer.render_text.unwrap;
Configuration
use ;
let renderer = with_config;
Key Decisions
- No
<style>blocks — Gmail strips them. Everything is inlined. - DOCTYPE included by default —
<!DOCTYPE html>ensures standards mode. - Void elements are self-closing:
<img />,<hr />,<br />,<meta />. - Text escaping handles
&,<,>in content and additionally",'in attributes.
License
MIT OR Apache-2.0