Skip to main content

max / pter

1.2 KB · 34 lines History Blame Raw
1 # pter
2
3 **Plain Text Email Renderer** — convert HTML email bodies into readable markdown.
4
5 Email HTML is a hostile environment: table-based layouts from 2004, tracking pixels,
6 Outlook conditional comments, deeply nested reply chains with inconsistent quoting.
7 pter converts all of it into clean, readable markdown.
8
9 ## Usage
10
11 ```rust
12 let html = r#"<h1>Hello</h1><p>This is an <strong>email</strong>.</p>"#;
13 let markdown = pter::convert(html);
14 assert_eq!(markdown, "# Hello\n\nThis is an **email**.");
15 ```
16
17 ## What it does
18
19 - Converts HTML elements to markdown equivalents (headings, links, lists, emphasis, code, images)
20 - Unwraps table-based email layouts (single-cell tables become content, multi-column linearizes)
21 - Detects and normalizes reply chains into `>` quoted markdown
22 - Strips tracking pixels, invisible elements, and Outlook conditional comments
23 - Produces output that is readable as plain text and renderable by any markdown toolchain
24
25 ## What it does not do
26
27 - Parse MIME email structure (use `mailparse` or `mail-parser` for that)
28 - Extract article content from marketing templates (compose with a separate extractor)
29 - Render markdown to a display format (use `pulldown-cmark`, `comrak`, etc.)
30
31 ## License
32
33 MIT
34