...

Source file src/github.com/alecthomas/chroma/formatters/tokens.go

Documentation: github.com/alecthomas/chroma/formatters

     1  package formatters
     2  
     3  import (
     4  	"fmt"
     5  	"io"
     6  
     7  	"github.com/alecthomas/chroma"
     8  )
     9  
    10  // Tokens formatter outputs the raw token structures.
    11  var Tokens = Register("tokens", chroma.FormatterFunc(func(w io.Writer, s *chroma.Style, it chroma.Iterator) error {
    12  	for t := it(); t != chroma.EOF; t = it() {
    13  		if _, err := fmt.Fprintln(w, t.GoString()); err != nil {
    14  			return err
    15  		}
    16  	}
    17  	return nil
    18  }))
    19  

View as plain text