forked from tangled.org/core
this repo has no description

appview/pages: unconditionally apply syntax highlights

Signed-off-by: oppiliappan <me@oppi.li>

oppi.li 8b73729e 418ce504

verified
Changed files
+21 -24
appview
pages
+21 -24
appview/pages/pages.go
···
}
}
-
if params.Lines < 5000 {
-
c := params.Contents
-
formatter := chromahtml.New(
-
chromahtml.InlineCode(false),
-
chromahtml.WithLineNumbers(true),
-
chromahtml.WithLinkableLineNumbers(true, "L"),
-
chromahtml.Standalone(false),
-
chromahtml.WithClasses(true),
-
)
+
c := params.Contents
+
formatter := chromahtml.New(
+
chromahtml.InlineCode(false),
+
chromahtml.WithLineNumbers(true),
+
chromahtml.WithLinkableLineNumbers(true, "L"),
+
chromahtml.Standalone(false),
+
chromahtml.WithClasses(true),
+
)
-
lexer := lexers.Get(filepath.Base(params.Path))
-
if lexer == nil {
-
lexer = lexers.Fallback
-
}
+
lexer := lexers.Get(filepath.Base(params.Path))
+
if lexer == nil {
+
lexer = lexers.Fallback
+
}
-
iterator, err := lexer.Tokenise(nil, c)
-
if err != nil {
-
return fmt.Errorf("chroma tokenize: %w", err)
-
}
-
-
var code bytes.Buffer
-
err = formatter.Format(&code, style, iterator)
-
if err != nil {
-
return fmt.Errorf("chroma format: %w", err)
-
}
+
iterator, err := lexer.Tokenise(nil, c)
+
if err != nil {
+
return fmt.Errorf("chroma tokenize: %w", err)
+
}
-
params.Contents = code.String()
+
var code bytes.Buffer
+
err = formatter.Format(&code, style, iterator)
+
if err != nil {
+
return fmt.Errorf("chroma format: %w", err)
}
+
params.Contents = code.String()
params.Active = "overview"
return p.executeRepo("repo/blob", w, params)
}