mirror of
https://github.com/skidoodle/pastebin
synced 2025-10-14 09:44:48 +02:00
rename file
This commit is contained in:
@@ -2,8 +2,10 @@ package handler
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/a-h/templ"
|
||||
"github.com/alecthomas/chroma/v2/formatters/html"
|
||||
"github.com/alecthomas/chroma/v2/lexers"
|
||||
"github.com/alecthomas/chroma/v2/styles"
|
||||
@@ -56,3 +58,10 @@ func highlight(content, ext, theme string) (string, error) {
|
||||
}
|
||||
return buf.String(), nil
|
||||
}
|
||||
|
||||
func render(component templ.Component, w http.ResponseWriter, r *http.Request) {
|
||||
err := component.Render(r.Context(), w)
|
||||
if err != nil {
|
||||
internal("could not render template", err, w, r)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user