mirror of
https://github.com/TECHNOFAB11/docsonnet.git
synced 2025-12-12 06:20:12 +01:00
feat: make paths work
This commit is contained in:
parent
21c8ebc75f
commit
75f8e7373c
6 changed files with 83 additions and 77 deletions
19
pkg/md/md.go
19
pkg/md/md.go
|
|
@ -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)}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue