...

Package quick

import "github.com/alecthomas/chroma/v2/quick"
Overview
Index
Examples

Overview ▾

Package quick provides simple, no-configuration source code highlighting.

Example

Code:

code := `package main

func main() { }
`
err := quick.Highlight(os.Stdout, code, "go", "html", "monokai")
if err != nil {
    log.Fatal(err)
}

func Highlight

func Highlight(w io.Writer, source, lexer, formatter, style string) error

Highlight some text.

Lexer, formatter and style may be empty, in which case a best-effort is made.