fix syntax highlighting for fileview
このコミットが含まれているのは:
コミット
96c9c8501e
|
@ -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()),
|
||||
|
|
|
@ -3,11 +3,7 @@
|
|||
<main>
|
||||
{{ if .file }}
|
||||
<style>
|
||||
{
|
||||
{
|
||||
.css;
|
||||
}
|
||||
}
|
||||
{{.css}};
|
||||
</style>
|
||||
<div class="downloadParent">
|
||||
<a href="/{{.fullname}}" class="button">Back to {{.fullname}}</a>
|
||||
|
|
読み込み中…
新しいイシューから参照