func Digest(c *Config, open, closed []*PullRequest) error {
	sortedOpen := PullRequests(open)
	sortedClosed := PullRequests(closed)
	sort.Sort(sortedOpen)
	sort.Sort(sortedClosed)
	now := time.Now()
	content := struct {
		Open   []*PullRequest
		Closed []*PullRequest
	}{
		Open:   sortedOpen,
		Closed: sortedClosed,
	}
	htmlTemplate, err := ioutil.ReadFile(c.Template)
	if err != nil {
		return fmt.Errorf("failed to read template file %q: %s", c.Template, err)
	}
	tmpl := template.Must(template.New("digest").Funcs(template.FuncMap{"markDown": markDowner}).Parse(string(htmlTemplate)))
	buf := new(bytes.Buffer)
	if err := tmpl.Execute(buf, content); err != nil {
		return err
	}
	contents := buf.String()
	if c.InlineStyles {
		options := premailer.NewOptions()
		options.CssToAttributes = true
		prem := premailer.NewPremailerFromString(buf.String(), options)
		contents, err = prem.Transform()
		if err != nil {
			return err
		}
	}
	f, err := createFile(c.OutDir, fmt.Sprintf("digest-%s.html", now.Format("01-02-2006")))
	if err != nil {
		return err
	}
	defer f.Close()
	_, err = f.WriteString(contents)
	if err != nil {
		return err
	}
	fmt.Fprintf(os.Stdout, "digest: %s\n", f.Name())
	return nil
}
Digest computes the digest from provided slices of open and
closed pull requests.
package main
import (
	"bytes"
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"sort"
	"text/template"
	"time"
	"github.com/shurcooL/github_flavored_markdown"
	"github.com/vanng822/go-premailer/premailer"
)
type PullRequests []*PullRequest
func (slice PullRequests) Len() int {
	return len(slice)
}
func (slice PullRequests) Less(i, j int) bool {
	return slice[i].TotalChanges() > slice[j].TotalChanges()
}
func (slice PullRequests) Swap(i, j int) {
	slice[i], slice[j] = slice[j], slice[i]
}
func markDowner(args ...interface{}) string {
	return string(github_flavored_markdown.Markdown([]byte(fmt.Sprintf("%s", args...))))
}