diff --git a/.golangci.yml b/.golangci.yml
new file mode 100644
index 0000000..d70bd65
--- /dev/null
+++ b/.golangci.yml
@@ -0,0 +1,16 @@
+run:
+ timeout: 5m
+
+linters:
+ enable:
+ - megacheck
+ - govet
+ disable:
+ - errcheck
+ - maligned
+ - prealloc
+ disable-all: false
+ presets:
+ - bugs
+ - unused
+ fast: false
diff --git a/example/main.go b/example/main.go
index 4360f1a..c316ca0 100644
--- a/example/main.go
+++ b/example/main.go
@@ -31,7 +31,7 @@ func main() {
r = bfchroma.NewRenderer(
bfchroma.WithoutAutodetect(),
bfchroma.Extend(b),
- bfchroma.ChromaOptions(html.WithLineNumbers()),
+ bfchroma.ChromaOptions(html.WithLineNumbers(true)),
)
h = bf.Run([]byte(md), bf.WithRenderer(r))
fmt.Println(string(h))
@@ -42,7 +42,7 @@ func main() {
fmt.Println(string(h))
md = "```go\npackage main\n\nfunc main() {\n}\n```"
- r = bfchroma.NewRenderer(bfchroma.ChromaOptions(html.WithLineNumbers()))
+ r = bfchroma.NewRenderer(bfchroma.ChromaOptions(html.WithLineNumbers(true)))
h = bf.Run([]byte(md), bf.WithRenderer(r))
fmt.Println(string(h))
}
diff --git a/go.mod b/go.mod
index 2fd48fa..fc0c3bd 100644
--- a/go.mod
+++ b/go.mod
@@ -1,20 +1,11 @@
module github.com/Depado/bfchroma
-go 1.13
+go 1.14
require (
- github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 // indirect
- github.com/alecthomas/chroma v0.6.0
- github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721 // indirect
- github.com/alecthomas/repr v0.0.0-20181024024818-d37bc2a10ba1 // indirect
- github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 // indirect
- github.com/davecgh/go-spew v1.1.1 // indirect
- github.com/dlclark/regexp2 v1.1.6 // indirect
- github.com/mattn/go-isatty v0.0.4 // indirect
- github.com/pmezard/go-difflib v1.0.0 // indirect
+ github.com/alecthomas/chroma v0.7.3
+ github.com/alecthomas/repr v0.0.0-20200325044227-4184120f674c // indirect
github.com/russross/blackfriday/v2 v2.0.1
- github.com/sergi/go-diff v1.0.0 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
- github.com/stretchr/testify v1.2.2
- golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8 // indirect
+ github.com/stretchr/testify v1.6.1
)
diff --git a/go.sum b/go.sum
index c196dc2..4677ed2 100644
--- a/go.sum
+++ b/go.sum
@@ -1,19 +1,25 @@
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 h1:smF2tmSOzy2Mm+0dGI2AIUHY+w0BUc+4tn40djz7+6U=
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI=
-github.com/alecthomas/chroma v0.6.0 h1:gcvXlpe0/NoQP3BvneRfgcauLIJDw9VblkoFwZ5XGFs=
-github.com/alecthomas/chroma v0.6.0/go.mod h1:MmozekIi2rfQSzDcdEZ2BoJ9Pxs/7uc2Y4Boh+hIeZo=
+github.com/alecthomas/chroma v0.7.3 h1:NfdAERMy+esYQs8OXk0I868/qDxxCEo7FMz1WIqMAeI=
+github.com/alecthomas/chroma v0.7.3/go.mod h1:sko8vR34/90zvl5QdcUdvzL3J8NKjAUx9va9jPuFNoM=
github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721 h1:JHZL0hZKJ1VENNfmXvHbgYlbUOvpzYzvy2aZU5gXVeo=
github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0=
-github.com/alecthomas/repr v0.0.0-20181024024818-d37bc2a10ba1 h1:GDQdwm/gAcJcLAKQQZGOJ4knlw+7rfEQQcmwTbt4p5E=
-github.com/alecthomas/repr v0.0.0-20181024024818-d37bc2a10ba1/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ=
+github.com/alecthomas/kong v0.2.4/go.mod h1:kQOmtJgV+Lb4aj+I2LEn40cbtawdWJ9Y8QLq+lElKxE=
+github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ=
+github.com/alecthomas/repr v0.0.0-20200325044227-4184120f674c h1:MVVbswUlqicyj8P/JljoocA7AyCo62gzD0O7jfvrhtE=
+github.com/alecthomas/repr v0.0.0-20200325044227-4184120f674c/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ=
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ=
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/dlclark/regexp2 v1.1.6 h1:CqB4MjHw0MFCDj+PHHjiESmHX+N7t0tJzKvC6M97BRg=
-github.com/dlclark/regexp2 v1.1.6/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
-github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=
-github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
+github.com/dlclark/regexp2 v1.2.0 h1:8sAhBGEM0dRWogWqWyQeIJnxjWO6oIjl8FKqREDsGfk=
+github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
+github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
+github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
+github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
+github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
@@ -22,7 +28,19 @@ github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
+github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
-golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8 h1:YoY1wS6JYVRpIfFngRf2HHo9R9dAne3xbkGOQ5rJXjU=
-golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
+github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
+github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200413165638-669c56c373c4 h1:opSr2sbRXk5X5/givKrrKj9HXxFpW2sdCiP8MJSKLQY=
+golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
+gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
diff --git a/renderer_test.go b/renderer_test.go
index 0912c35..c6a4746 100644
--- a/renderer_test.go
+++ b/renderer_test.go
@@ -8,9 +8,9 @@ import (
"github.com/alecthomas/chroma"
"github.com/alecthomas/chroma/formatters/html"
"github.com/alecthomas/chroma/styles"
+ bf "github.com/russross/blackfriday/v2"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
- bf "github.com/russross/blackfriday/v2"
)
func TestExtend(t *testing.T) {
@@ -90,13 +90,13 @@ func ExampleWithoutAutodetect() {
}
func TestChromaOptions(t *testing.T) {
- NewRenderer(ChromaOptions(html.WithClasses()))
+ NewRenderer(ChromaOptions(html.WithClasses(true)))
}
func ExampleChromaOptions() {
md := "```go\npackage main\n\nfunc main() {\n}\n```"
- r := NewRenderer(ChromaOptions(html.WithLineNumbers()))
+ r := NewRenderer(ChromaOptions(html.WithLineNumbers(true)))
h := bf.Run([]byte(md), bf.WithRenderer(r))
fmt.Println(string(h))
@@ -151,17 +151,17 @@ func TestRender(t *testing.T) {
func TestRender_EmbedCSS(t *testing.T) {
r := NewRenderer(EmbedCSS())
h := bf.Run([]byte(""), bf.WithRenderer(r))
- assert.Contains(t, string(h),"")
+ assert.Contains(t, string(h), "")
}
func TestRenderer_ChromaCSS(t *testing.T) {
r := NewRenderer()
var w bytes.Buffer
err := r.ChromaCSS(&w)
- require.NoError(t,err)
- assert.Contains(t, w.String(),".chroma")
+ require.NoError(t, err)
+ assert.Contains(t, w.String(), ".chroma")
}
@@ -175,7 +175,7 @@ func ExampleNewRenderer() {
})),
WithoutAutodetect(),
ChromaStyle(styles.GitHub),
- ChromaOptions(html.WithLineNumbers()),
+ ChromaOptions(html.WithLineNumbers(true)),
)
h := bf.Run([]byte(md), bf.WithRenderer(r))