From 96c9c8501eb525b1578442f344e753b467eda089 Mon Sep 17 00:00:00 2001 From: Arya Kiran Date: Thu, 9 Mar 2023 15:26:32 +0530 Subject: [PATCH] fix syntax highlighting for fileview --- pages/fileview.go | 6 ++---- views/file.html | 6 +----- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/pages/fileview.go b/pages/fileview.go index 700b91e..b3ec43d 100644 --- a/pages/fileview.go +++ b/pages/fileview.go @@ -4,13 +4,12 @@ import ( "bufio" "bytes" "context" - "html/template" - htmlfmt "github.com/alecthomas/chroma/v2/formatters/html" "github.com/alecthomas/chroma/v2/lexers" "github.com/alecthomas/chroma/v2/styles" "github.com/carlmjohnson/requests" "github.com/gofiber/fiber/v2" + "html/template" ) // FileView is the file view page @@ -27,7 +26,7 @@ func FileView(c *fiber.Ctx) error { }) } - lexer := lexers.Match(c.Params("file")) + lexer := lexers.Match(c.Params("+")) if lexer == nil { lexer = lexers.Fallback } @@ -56,7 +55,6 @@ func FileView(c *fiber.Ctx) error { writer.Flush() cssw.Flush() - return c.Render("file", fiber.Map{ "file": template.HTML(buf.String()), "css": template.CSS(cssbuf.String()), diff --git a/views/file.html b/views/file.html index 9f58fb8..685493f 100644 --- a/views/file.html +++ b/views/file.html @@ -3,11 +3,7 @@
{{ if .file }}