reprogl
1package views2
3import (4"bytes"5"io/fs"6
7"github.com/yuin/goldmark"8emoji "github.com/yuin/goldmark-emoji"9)
10
11func MarkdownToHTML(fname string) ([]byte, error) {12source, err := fs.ReadFile(sources, "markdown/"+fname)13if err != nil {14return nil, err15}16
17md := goldmark.New(18goldmark.WithExtensions(19emoji.Emoji,20))21var buf bytes.Buffer22if err = md.Convert(source, &buf); err != nil {23return nil, err24}25
26return buf.Bytes(), nil27}
28