Load style from json

This commit is contained in:
Toby Padilla 2019-11-09 14:07:01 -06:00
commit dda88169f4
2 changed files with 20 additions and 2 deletions

10
dark.json Normal file
View file

@ -0,0 +1,10 @@
{
"link": {
"color": "123",
"underline": true
},
"heading": {
"bold": true,
"inverse": true
}
}

12
main.go
View file

@ -1,7 +1,9 @@
package main
import (
"flag"
"fmt"
"os"
"github.com/magicnumbers/gold"
bf "gopkg.in/russross/blackfriday.v2"
@ -22,7 +24,13 @@ This is a test yo.
`
func main() {
r := gold.TermRenderer{}
out := bf.Run([]byte(tmd), bf.WithRenderer(&r))
s := flag.String("s", "", "style json path")
flag.Parse()
r, err := gold.NewTermRenderer(*s)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
out := bf.Run([]byte(tmd), bf.WithRenderer(r))
fmt.Println(string(out))
}