all repos — vite @ 4ca05429e8f957879142a9b73eaa8b0b60677105

a fast (this time, actually) and minimal static site generator

markdown/frontmatter.go (view raw)

 1package markdown
 2
 3import (
 4	"bytes"
 5
 6	"github.com/adrg/frontmatter"
 7)
 8
 9type Matter map[string]string
10
11type MarkdownDoc struct {
12	Frontmatter Matter
13	Body        []byte
14}
15
16func (md *MarkdownDoc) Extract(source []byte) error {
17	r := bytes.NewReader(source)
18	rest, err := frontmatter.Parse(r, &md.Frontmatter)
19	if err != nil {
20		return err
21	}
22	md.Body = rest
23	return nil
24}