git-preview @ main

static git web frontend but with images and html previews + code truncation

routes: add syntax highlight
Sun, 14 Jul 2024
5 files changed, 72 insertions(+), 5 deletions(-)
M config/config.go

@@ -21,8 +21,9 @@ Templates string `yaml:"templates"`

Static string `yaml:"static"` } `yaml:"dirs"` Meta struct { - Title string `yaml:"title"` - Description string `yaml:"description"` + Title string `yaml:"title"` + Description string `yaml:"description"` + SyntaxHighlight string `yaml:"syntaxHighlight"` } `yaml:"meta"` Server struct {

… preview truncated

M routes/routes.go

@@ -225,6 +225,10 @@ return

} contents, err := gr.FileContent(treePath) + if err != nil { + d.Write500(w) + return + } data := make(map[string]any) data["name"] = name data["displayname"] = getDisplayName(name)

… preview truncated

M routes/template.go

@@ -10,6 +10,9 @@ "path/filepath"

"strings" "git.icyphox.sh/legit/git" + "github.com/alecthomas/chroma/v2/formatters/html" + "github.com/alecthomas/chroma/v2/lexers" + "github.com/alecthomas/chroma/v2/styles" ) func (d *deps) Write404(w http.ResponseWriter) {

@@ -69,6 +72,48 @@ }

}

… preview truncated

… and 2 more changed files not shown in this preview