diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/highlight/highlight.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/highlight/highlight.go b/modules/highlight/highlight.go index a5c38940a7..fac682b8a8 100644 --- a/modules/highlight/highlight.go +++ b/modules/highlight/highlight.go @@ -36,6 +36,8 @@ var ( once sync.Once cache *lru.TwoQueueCache + + githubStyles = styles.Get("github") ) // NewContext loads custom highlight map from local config @@ -121,7 +123,7 @@ func CodeFromLexer(lexer chroma.Lexer, code string) string { return code } // style not used for live site but need to pass something - err = formatter.Format(htmlw, styles.GitHub, iterator) + err = formatter.Format(htmlw, githubStyles, iterator) if err != nil { log.Error("Can't format code: %v", err) return code @@ -184,7 +186,7 @@ func File(fileName, language string, code []byte) ([]string, string, error) { lines := make([]string, 0, len(tokensLines)) for _, tokens := range tokensLines { iterator = chroma.Literator(tokens...) - err = formatter.Format(htmlBuf, styles.GitHub, iterator) + err = formatter.Format(htmlBuf, githubStyles, iterator) if err != nil { return nil, "", fmt.Errorf("can't format code: %w", err) } |