comparison wdown.go @ 4:0b747e2d51c9

Add syntax highlighting support
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 16 Jun 2020 21:11:38 +0200
parents adf9c2b90279
children 534fa4c6668e
comparison
equal deleted inserted replaced
3:20d89feaa7d7 4:0b747e2d51c9
4 "io/ioutil" 4 "io/ioutil"
5 "log" 5 "log"
6 "os" 6 "os"
7 7
8 "github.com/yuin/goldmark" 8 "github.com/yuin/goldmark"
9 highlighting "github.com/yuin/goldmark-highlighting"
9 "github.com/yuin/goldmark/extension" 10 "github.com/yuin/goldmark/extension"
10 "github.com/yuin/goldmark/parser" 11 "github.com/yuin/goldmark/parser"
11 ) 12 )
12 13
13 func main() { 14 func main() {
16 if err != nil { 17 if err != nil {
17 log.Fatal(err) 18 log.Fatal(err)
18 } 19 }
19 20
20 md := goldmark.New( 21 md := goldmark.New(
21 goldmark.WithExtensions(extension.GFM), 22 goldmark.WithExtensions(
23 extension.GFM,
24 highlighting.Highlighting,
25 ),
22 goldmark.WithParserOptions( 26 goldmark.WithParserOptions(
23 parser.WithAutoHeadingID(), 27 parser.WithAutoHeadingID(),
24 ), 28 ),
25 ) 29 )
26 30