Mercurial > yakumo_izuru > aya
changeset 65:6d985efa0f7a draft
Add support for bfchroma syntax highlighting
Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>
author | yakumo.izuru |
---|---|
date | Mon, 08 May 2023 21:10:36 +0000 |
parents | 0716397c44e8 |
children | 787b5ee0289d |
files | README.md cmd/aya/main.go go.mod go.sum |
diffstat | 4 files changed, 19 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/README.md Sun May 07 13:59:02 2023 +0000 +++ b/README.md Mon May 08 21:10:36 2023 +0000 @@ -11,6 +11,7 @@ * 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
--- a/cmd/aya/main.go Sun May 07 13:59:02 2023 +0000 +++ b/cmd/aya/main.go Mon May 08 21:10:36 2023 +0000 @@ -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 @@ log "github.com/sirupsen/logrus" "github.com/eknkc/amber" "github.com/yosssi/gcss" + "github.com/Depado/bfchroma/v2" ) const ( @@ -185,9 +186,8 @@ 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")))
--- a/go.mod Sun May 07 13:59:02 2023 +0000 +++ b/go.mod Mon May 08 21:10:36 2023 +0000 @@ -3,6 +3,7 @@ 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 @@ 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 +)
--- a/go.sum Sun May 07 13:59:02 2023 +0000 +++ b/go.sum Mon May 08 21:10:36 2023 +0000 @@ -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=