1
0
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:
Alec Thomas
2017-06-06 21:23:50 +10:00
parent ef4a53333b
commit d852022f8d
15 changed files with 261 additions and 253 deletions

18
formatter.go Normal file
View 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)
}