package quick

import "github.com/alecthomas/chroma/v2/quick"

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

Example

Code:play 

package main

import (
	"log"
	"os"

	"github.com/alecthomas/chroma/v2/quick"
)

func main() {
	code := `package main

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

Index

Examples

Functions

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.

Source Files

quick.go

Version
v2.0.0-alpha4
Published
Mar 2, 2022
Platform
js/wasm
Imports
5 packages
Last checked
25 minutes ago

Tools for package owners.