Changes
5 changed files (+10/-11)
-
-
@@ -45,6 +45,10 @@# Website's description. description: "web frontend for git repositories, written in Go" # Whether highlight repository's text file. # NOTE: This applies only to blob page. Code blocks inside README will be untouched. syntaxHighlight: true server: # legit uses this strings for clone URL. # `https://<name>/<directory>`
-
-
-
@@ -23,7 +23,7 @@ } `yaml:"dirs"`Meta struct { Title string `yaml:"title"` Description string `yaml:"description"` SyntaxHighlight string `yaml:"syntaxHighlight"` SyntaxHighlight bool `yaml:"syntaxHighlight"` } `yaml:"meta"` Server struct { Name string `yaml:"name,omitempty"`
-
-
-
@@ -38,7 +38,7 @@meta: title: legit Demo description: Test legit features with real repositories. syntaxHighlight: monokailight syntaxHighlight: true server: name: example.com
-
-
-
@@ -309,8 +309,8 @@ Content: contents,LineNumbers: lines, } if d.c.Meta.SyntaxHighlight != "" { highlighted, err := highlightCode(treePath, contents, d.c.Meta.SyntaxHighlight) if d.c.Meta.SyntaxHighlight { highlighted, err := highlightCode(treePath, contents) if err != nil { log.Println(err) } else {
-
-
-
@@ -90,7 +90,7 @@ }} } func highlightCode(fileName string, code string, styleQuery string) (template.HTML, error) { func highlightCode(fileName string, code string) (template.HTML, error) { lexer := lexers.Get(fileName) // Do not process if no appropriate highlighter was found.
-
@@ -98,11 +98,6 @@ if lexer == nil {return "", nil } style := styles.Get(styleQuery) if style == nil { return "", fmt.Errorf("No chroma style found for '%s'", styleQuery) } formatter := html.New(html.WithClasses(true), html.ClassPrefix("chroma-")) iter, err := lexer.Tokenise(nil, code)
-
@@ -111,7 +106,7 @@ return "", fmt.Errorf("Failed to tokenize code: %s", err)} var output bytes.Buffer err = formatter.Format(&output, style, iter) err = formatter.Format(&output, styles.Fallback, iter) if err != nil { return "", fmt.Errorf("Failed to highlight code: %s", err) }
-