2018-05-01 15:01:40 +05:00
|
|
|
package formatters
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
|
|
|
|
"github.com/alecthomas/chroma"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Tokens formatter outputs the raw token structures.
|
|
|
|
var Tokens = Register("tokens", chroma.FormatterFunc(func(w io.Writer, s *chroma.Style, it chroma.Iterator) error {
|
2019-03-07 08:43:28 +05:00
|
|
|
for t := it(); t != chroma.EOF; t = it() {
|
2018-05-01 15:01:40 +05:00
|
|
|
if _, err := fmt.Fprintln(w, t.GoString()); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}))
|