pter 0.1.0

Plain Text Email Renderer — convert HTML email bodies into readable markdown
Documentation
  • Coverage
  • 100%
    2 out of 2 items documented1 out of 1 items with examples
  • Size
  • Source code size: 137.64 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 540.68 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • MaxJMath

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