all repos — navani @ 3d75c4dca23f65ff2a15678e06f6979c012c71b3

forlater's primary mail processing service

reader/plain.go (view raw)

 1package reader
 2
 3import (
 4	"os/exec"
 5	"strings"
 6)
 7
 8func MakePlaintext(html []byte) ([]byte, error) {
 9	args := []string{
10		"-dont_wrap_pre",
11		"-display_charset=UTF-8",
12		"-image_links",
13		"-dump",
14		"-stdin",
15	}
16	cmd := exec.Command("lynx", args...)
17	cmd.Stdin = strings.NewReader(string(html))
18	out, err := cmd.Output()
19	if err != nil {
20		return nil, err
21	}
22	return out, nil
23}