mirror of
https://github.com/alecthomas/chroma.git
synced 2025-11-23 22:24:39 +02:00
Move style and formatter API into chroma package.
This commit is contained in:
18
formatter.go
Normal file
18
formatter.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package chroma
|
||||
|
||||
import (
|
||||
"io"
|
||||
)
|
||||
|
||||
// A Formatter for Chroma lexers.
|
||||
type Formatter interface {
|
||||
// Format returns a formatting function for tokens.
|
||||
Format(w io.Writer, style *Style) (func(*Token), error)
|
||||
}
|
||||
|
||||
// A FormatterFunc is a Formatter implemented as a function.
|
||||
type FormatterFunc func(io.Writer, *Style) (func(*Token), error)
|
||||
|
||||
func (f FormatterFunc) Format(w io.Writer, s *Style) (func(*Token), error) {
|
||||
return f(w, s)
|
||||
}
|
||||
Reference in New Issue
Block a user