feat: make paths work

This commit is contained in:
sh0rez 2020-05-02 19:54:34 +02:00
parent 21c8ebc75f
commit 75f8e7373c
No known key found for this signature in database
GPG key ID: 87C71DF9F8181FF1
6 changed files with 83 additions and 77 deletions

View file

@ -3,6 +3,8 @@ package md
import (
"fmt"
"strings"
"gopkg.in/yaml.v2"
)
type Elem interface {
@ -128,3 +130,20 @@ func Link(desc Elem, href string) LinkType {
href: href,
}
}
type FrontmatterType struct {
yaml string
}
func (f FrontmatterType) String() string {
return "---\n" + f.yaml + "---"
}
func Frontmatter(data map[string]interface{}) FrontmatterType {
d, err := yaml.Marshal(data)
if err != nil {
panic(err)
}
return FrontmatterType{yaml: string(d)}
}