1goldmark-highlighting
2=========================
3
4goldmark-highlighting is an extension for the [goldmark](http://github.com/yuin/goldmark)
5that adds syntax-highlighting to the fenced code blocks.
6
7goldmark-highlighting uses [chroma](https://github.com/alecthomas/chroma) as a
8syntax highlighter.
9
10Installation
11--------------------
12
13```
14go get github.com/yuin/goldmark-highlighting/v2
15```
16
17Usage
18--------------------
19
20```go
21import (
22 "bytes"
23 "fmt"
24 "github.com/alecthomas/chroma/formatters/html"
25 "github.com/yuin/goldmark"
26 "github.com/yuin/goldmark/extension"
27 "github.com/yuin/goldmark/parser"
28 "github.com/yuin/goldmark-highlighting/v2"
29
30)
31
32func main() {
33 markdown := goldmark.New(
34 goldmark.WithExtensions(
35 highlighting.Highlighting,
36 ),
37 )
38 var buf bytes.Buffer
39 if err := markdown.Convert([]byte(source), &buf); err != nil {
40 panic(err)
41 }
42 fmt.Print(title)
43}
44```
45
46
47```go
48 markdown := goldmark.New(
49 goldmark.WithExtensions(
50 highlighting.NewHighlighting(
51 highlighting.WithStyle("monokai"),
52 highlighting.WithFormatOptions(
53 html.WithLineNumbers(),
54 ),
55 ),
56 ),
57 )
58```
59
60License
61--------------------
62MIT
63
64Author
65--------------------
66Yusuke Inuzuka