#markdown-converter #plain-text

pter

Plain Text Email Renderer — convert HTML email bodies into readable markdown

3 unstable releases

Uses new Rust 2024

new 0.2.0 Aug 1, 2026
0.1.1 Jul 19, 2026
0.1.0 May 24, 2026

#35 in #markdown-converter

MIT license

80KB
1.5K SLoC

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 = pter::convert(html);
assert_eq!(markdown, "# Hello\n\nThis is an **email**.");

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 mailparse or mail-parser for 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

Dependencies

~3.5MB
~77K SLoC