aboutsummaryrefslogtreecommitdiff
path: root/forged/internal/render/chroma.go
diff options
context:
space:
mode:
Diffstat (limited to 'forged/internal/render/chroma.go')
-rw-r--r--forged/internal/render/chroma.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/forged/internal/render/chroma.go b/forged/internal/render/chroma.go
index c1a1869..64bfde0 100644
--- a/forged/internal/render/chroma.go
+++ b/forged/internal/render/chroma.go
@@ -12,6 +12,9 @@ import (
chromaStyles "github.com/alecthomas/chroma/v2/styles"
)
+// Highlight returns HTML with syntax highlighting for the given file content,
+// using Chroma. The lexer is selected based on the filename.
+// If tokenization or formatting fails, a fallback <pre> block is returned with the error.
func Highlight(filename, content string) template.HTML {
lexer := chromaLexers.Match(filename)
if lexer == nil {