diff --git a/README.md b/README.md index dc64136..965aa71 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ Named after [Aya Shameimaru](https://en.touhouwiki.net/wiki/Aya_Shameimaru) from * Highly extensible * Works well for blogs and generic static websites (landing pages etc) * Easy to learn +* Code highlighting with [bfchroma](https://github.com/Depado/bfchroma) * Fast (duh!) ## Installation diff --git a/cmd/aya/main.go b/cmd/aya/main.go index b242692..0c672dd 100644 --- a/cmd/aya/main.go +++ b/cmd/aya/main.go @@ -1,4 +1,4 @@ -// $TheSupernovaDuo: cmd/aya/main.go,v 0.5.x 2023/5/7 10:57:10 yakumo_izuru Exp $ +// $TheSupernovaDuo: cmd/aya/main.go,v 0.5.x 2023/5/8 18:6:18 yakumo_izuru Exp $ package main import ( @@ -19,6 +19,7 @@ import ( log "github.com/sirupsen/logrus" "github.com/eknkc/amber" "github.com/yosssi/gcss" + "github.com/Depado/bfchroma/v2" ) const ( @@ -185,9 +186,8 @@ func buildMarkdown(path string, w io.Writer, vars Vars) error { if err != nil { return err } - v["content"] = string(blackfriday.Run( - []byte(content), - blackfriday.WithExtensions(blackfriday.CommonExtensions|blackfriday.AutoHeadingIDs), + v["content"] = string(blackfriday.Run([]byte(content), + blackfriday.WithExtensions(blackfriday.CommonExtensions|blackfriday.AutoHeadingIDs),blackfriday.WithRenderer(bfchroma.NewRenderer()), )) if w == nil { out, err := os.Create(filepath.Join(PUBDIR, renameExt(path, "", ".html"))) diff --git a/go.mod b/go.mod index 7ef39df..754efb9 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module marisa.chaotic.ninja/aya go 1.17 require ( + github.com/Depado/bfchroma/v2 v2.0.0 github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385 github.com/russross/blackfriday/v2 v2.1.0 github.com/sirupsen/logrus v1.9.0 @@ -10,4 +11,8 @@ require ( gopkg.in/yaml.v2 v2.4.0 ) -require golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect +require ( + github.com/alecthomas/chroma/v2 v2.2.0 // indirect + github.com/dlclark/regexp2 v1.4.0 // indirect + golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect +) diff --git a/go.sum b/go.sum index 35c55c6..7d4482d 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,14 @@ +github.com/Depado/bfchroma/v2 v2.0.0 h1:IRpN9BPkNwEpR6w1ectIcNWOuhDSLx+8f1pn83fzxx8= +github.com/Depado/bfchroma/v2 v2.0.0/go.mod h1:wFwW/Pw8Tnd0irzgO9Zxtxgzp3aPS8qBWlyadxujxmw= +github.com/alecthomas/chroma/v2 v2.2.0 h1:Aten8jfQwUqEdadVFFjNyjx7HTexhKP0XuqBG67mRDY= +github.com/alecthomas/chroma/v2 v2.2.0/go.mod h1:vf4zrexSH54oEjJ7EdB65tGNHmH3pGZmVkgTP5RHvAs= +github.com/alecthomas/repr v0.0.0-20220113201626-b1b626ac65ae h1:zzGwJfFlFGD94CyyYwCJeSuD32Gj9GTaSi5y9hoVzdY= +github.com/alecthomas/repr v0.0.0-20220113201626-b1b626ac65ae/go.mod h1:2kn6fqh/zIyPLmm3ugklbEi5hg5wS435eygvNfaDQL8= 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.4.0 h1:F1rxgk7p4uKjwIQxBs9oAXe5CqrXlCduYEJvrF4u93E= +github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385 h1:clC1lXBpe2kTj2VHdaIu9ajZQe4kcEY9j0NsnDDBZ3o= github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=