diff --git a/config/dev-config.example.json b/config/dev-config.example.json index 5b22d1a..5e741c0 100644 --- a/config/dev-config.example.json +++ b/config/dev-config.example.json @@ -30,7 +30,7 @@ "branch": "trunk", "repository": "https://git.sr.ht/~jamesponddotco/credential-go", "license": "MIT", - "usage": "
1package main\n 2\n 3import (\n 4\t"fmt"\n 5\t"log"\n 6\n 7\t"git.sr.ht/~jamesponddotco/credential-go"\n 8)\n 9\n10func main() {\n11\t// Open the credential store with your application's name as the prefix.\n12\tstore, err := credential.Open("myapp")\n13\tif err != nil {\n14\t\tlog.Fatal(err)\n15\t}\n16\n17\t// Retrieve a secret from the store.\n18\tsecret, err := store.Get("database-password")\n19\tif err != nil {\n20\t\tlog.Fatal(err)\n21\t}\n22\n23\t// Print the secret or do something else with it.\n24\tfmt.Println("Database password:", secret)\n25}\n"
+ "usage": " 1package main\n 2\n 3import (\n 4\t"fmt"\n 5\t"log"\n 6\n 7\t"git.sr.ht/~jamesponddotco/credential-go"\n 8)\n 9\n10func main() {\n11\t// Open the credential store with your application's name as the prefix.\n12\tstore, err := credential.Open("myapp")\n13\tif err != nil {\n14\t\tlog.Fatal(err)\n15\t}\n16\n17\t// Retrieve a secret from the store.\n18\tsecret, err := store.Get("database-password")\n19\tif err != nil {\n20\t\tlog.Fatal(err)\n21\t}\n22\n23\t// Print the secret or do something else with it.\n24\tfmt.Println("Database password:", secret)\n25}\n"
},
{
"name": "xstd-go",
diff --git a/go.mod b/go.mod
index 85490c6..46e0fd5 100644
--- a/go.mod
+++ b/go.mod
@@ -10,7 +10,7 @@ require (
git.sr.ht/~jamesponddotco/acopw-go v1.0.2
git.sr.ht/~jamesponddotco/credential-go v1.0.0
git.sr.ht/~jamesponddotco/xstd-go v0.13.1
- github.com/alecthomas/chroma v0.10.0
+ github.com/alecthomas/chroma/v2 v2.17.0
github.com/blevesearch/bleve/v2 v2.5.0
github.com/json-iterator/go v1.1.12
github.com/microcosm-cc/bluemonday v1.0.27
@@ -40,7 +40,7 @@ require (
github.com/blevesearch/zapx/v14 v14.4.1 // indirect
github.com/blevesearch/zapx/v15 v15.4.1 // indirect
github.com/blevesearch/zapx/v16 v16.2.2 // indirect
- github.com/dlclark/regexp2 v1.4.0 // indirect
+ github.com/dlclark/regexp2 v1.11.5 // indirect
github.com/golang/geo v0.0.0-20210211234256-740aa86cb551 // indirect
github.com/golang/protobuf v1.3.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
diff --git a/go.sum b/go.sum
index 2e11a21..9875ea6 100644
--- a/go.sum
+++ b/go.sum
@@ -6,8 +6,12 @@ git.sr.ht/~jamesponddotco/xstd-go v0.13.1 h1:WSx3We/VOiZU9ohxxHXOoG48ZTp7RNMd+rY
git.sr.ht/~jamesponddotco/xstd-go v0.13.1/go.mod h1:2ImaAMHwlIUZQG4RDk7utC9ZG5HL+l6uQ3pwMjq1Q5s=
github.com/RoaringBitmap/roaring/v2 v2.4.5 h1:uGrrMreGjvAtTBobc0g5IrW1D5ldxDQYe2JW2gggRdg=
github.com/RoaringBitmap/roaring/v2 v2.4.5/go.mod h1:FiJcsfkGje/nZBZgCu0ZxCPOKD/hVXDS2dXi7/eUFE0=
-github.com/alecthomas/chroma v0.10.0 h1:7XDcGkCQopCNKjZHfYrNLraA+M7e0fMiJ/Mfikbfjek=
-github.com/alecthomas/chroma v0.10.0/go.mod h1:jtJATyUxlIORhUOFNA9NZDWGAQ8wpxQQqNSB4rjA/1s=
+github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0=
+github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
+github.com/alecthomas/chroma/v2 v2.17.0 h1:3r2Cgk+nXNICMBxIFGnTRTbQFUwMiLisW+9uos0TtUI=
+github.com/alecthomas/chroma/v2 v2.17.0/go.mod h1:RVX6AvYm4VfYe/zsk7mjHueLDZor3aWCNE14TFlepBk=
+github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc=
+github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
github.com/bits-and-blooms/bitset v1.12.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
@@ -52,8 +56,8 @@ github.com/blevesearch/zapx/v16 v16.2.2/go.mod h1:B9Pk4G1CqtErgQV9DyCSA9Lb7WZe4o
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/dlclark/regexp2 v1.11.5 h1:Q/sSnsKerHeCkc/jSTNq1oCm7KiVgUMZRDUoRu0JQZQ=
+github.com/dlclark/regexp2 v1.11.5/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
github.com/golang/geo v0.0.0-20210211234256-740aa86cb551 h1:gtexQ/VGyN+VVFRXSFiguSNcXmS6rkKT+X7FdIrTtfo=
github.com/golang/geo v0.0.0-20210211234256-740aa86cb551/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI=
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
@@ -65,6 +69,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8=
github.com/gorilla/css v1.0.1/go.mod h1:BvnYkspnSzMmwRK+b8/xgNPLiIuNZr6vbZBTPQ2A3b0=
+github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
+github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk=
diff --git a/internal/app/usage.go b/internal/app/usage.go
index abcb656..d908bd9 100644
--- a/internal/app/usage.go
+++ b/internal/app/usage.go
@@ -11,10 +11,10 @@ import (
"strings"
"git.sr.ht/~jamesponddotco/xstd-go/xunsafe"
- "github.com/alecthomas/chroma"
- "github.com/alecthomas/chroma/formatters/html"
- "github.com/alecthomas/chroma/lexers"
- "github.com/alecthomas/chroma/styles"
+ "github.com/alecthomas/chroma/v2"
+ "github.com/alecthomas/chroma/v2/formatters/html"
+ "github.com/alecthomas/chroma/v2/lexers"
+ "github.com/alecthomas/chroma/v2/styles"
jsoniter "github.com/json-iterator/go"
"go.cipher.host/cmdkit"
"go.cipher.host/pkgdex/internal/errors"
@@ -77,11 +77,11 @@ func GenerateUsageAction(args []string) error {
lexer = chroma.Coalesce(lexer)
- style := styles.GitHub
+ style := styles.Get("github")
formatter := html.New(
html.WithLineNumbers(true),
- html.LinkableLineNumbers(true, "usage-line-"),
+ html.WithLinkableLineNumbers(true, "usage-line-"),
html.TabWidth(4),
html.WithClasses(true),
html.Standalone(false),
diff --git a/static/assets/scss/highlight.scss b/static/assets/scss/highlight.scss
index 3455454..c22462e 100644
--- a/static/assets/scss/highlight.scss
+++ b/static/assets/scss/highlight.scss
@@ -68,6 +68,11 @@
white-space: pre;
}
+.chroma .ln a {
+ color: #9198a1;
+ text-decoration: none;
+}
+
.chroma .line {
display: flex;
}