chore: import official kitty sources from upstream
Bring the kovidgoyal/kitty codebase in as the base of FWS-Kitty, vendored at upstream commit 91fb38a without its git history.
This commit is contained in:
1134 files changed
+433629
No files matched your search
@@ -0,0 +1,32 @@
|
||||
package highlight
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/alecthomas/chroma/v2"
|
||||
"github.com/kovidgoyal/kitty/tools/utils"
|
||||
)
|
||||
|
||||
var _ = fmt.Print
|
||||
|
||||
var ErrNoLexer = errors.New("No lexer available for this format")
|
||||
|
||||
type StyleResolveData interface {
|
||||
StyleName() string
|
||||
UseLightColors() bool
|
||||
SyntaxAliases() map[string]string
|
||||
TextForPath(string) (string, error)
|
||||
}
|
||||
|
||||
type Highlighter interface {
|
||||
HighlightFile(path string, srd StyleResolveData) (highlighted_string string, err error)
|
||||
Sanitize(string) string
|
||||
}
|
||||
|
||||
func NewHighlighter(sanitize func(string) string) Highlighter {
|
||||
if sanitize == nil {
|
||||
sanitize = func(text string) string { return utils.ReplaceControlCodes(text, " ", "\n") }
|
||||
}
|
||||
return &highlighter{sanitize: sanitize, tokens_map: make(map[string][]chroma.Token)}
|
||||
}
|
||||
Reference in new issue
Block a user