pter
Plain Text Email Renderer — convert HTML email bodies into readable markdown.
Email HTML is a hostile environment: table-based layouts from 2004, tracking pixels, Outlook conditional comments, deeply nested reply chains with inconsistent quoting. pter converts all of it into clean, readable markdown.
Usage
let html = r#"<h1>Hello</h1><p>This is an <strong>email</strong>.</p>"#;
let markdown = convert;
assert_eq!;
What it does
- Converts HTML elements to markdown equivalents (headings, links, lists, emphasis, code, images)
- Unwraps table-based email layouts (single-cell tables become content, multi-column linearizes)
- Detects and normalizes reply chains into
>quoted markdown - Strips tracking pixels, invisible elements, and Outlook conditional comments
- Produces output that is readable as plain text and renderable by any markdown toolchain
What it does not do
- Parse MIME email structure (use
mailparseormail-parserfor that) - Extract article content from marketing templates (compose with a separate extractor)
- Render markdown to a display format (use
pulldown-cmark,comrak, etc.)
License
MIT