mirror of
https://github.com/charmbracelet/glow.git
synced 2026-08-09 09:49:09 +02:00
Load style from json
This commit is contained in:
parent
9da65bd2da
commit
dda88169f4
2 changed files with 20 additions and 2 deletions
10
dark.json
Normal file
10
dark.json
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"link": {
|
||||
"color": "123",
|
||||
"underline": true
|
||||
},
|
||||
"heading": {
|
||||
"bold": true,
|
||||
"inverse": true
|
||||
}
|
||||
}
|
||||
12
main.go
12
main.go
|
|
@ -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))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue